# Exception while decoding PUBACK: fixed header flags must be 0 but were 8

**URL:** <https://community.hivemq.com/t/exception-while-decoding-puback-fixed-header-flags-must-be-0-but-were-8/4016>\
**Category:** HiveMQ Client Library\
**Created:** [April 14, 2026, 1:02pm UTC](https://community.hivemq.com/t/exception-while-decoding-puback-fixed-header-flags-must-be-0-but-were-8/4016 "2026-04-14T13:02:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Boris](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@Boris](https://community.hivemq.com/u/Boris)\
**Post date:** [April 14, 2026, 1:02pm UTC](https://community.hivemq.com/t/exception-while-decoding-puback-fixed-header-flags-must-be-0-but-were-8/4016/1 "2026-04-14T13:02:21Z")

</div>

Hi,  
The server runs on [wss.certigo.com:443](http://wss.certigo.com:443)

I can connect to this server using `org.eclipse.paho.client.mqttv3.MqttClient`

I want to migrate to hivemq client library.

I receive this log when connect to the server `wss.certigo.com:443`

2026-04-14 13:01:54.365| DEBUG | com.hivemq.client.mqtt-1-1 | c.h.c.i.s.i.n.h.ssl.JdkSslContext - Default protocols (JDK): [TLSv1.3, TLSv1.2]2026-04-14 13:01:54.365| DEBUG | com.hivemq.client.mqtt-1-1 | c.h.c.i.s.i.n.h.ssl.JdkSslContext - Default cipher suites (JDK): [TLS\_ECDHE\_ECDSA\_WITH\_AES\_256\_GCM\_SHA384, TLS\_ECDHE\_ECDSA\_WITH\_AES\_128\_GCM\_SHA256, TLS\_ECDHE\_RSA\_WITH\_AES\_128\_GCM\_SHA256, TLS\_ECDHE\_RSA\_WITH\_AES\_256\_GCM\_SHA384, TLS\_ECDHE\_RSA\_WITH\_AES\_128\_CBC\_SHA, TLS\_ECDHE\_RSA\_WITH\_AES\_256\_CBC\_SHA, TLS\_AES\_128\_GCM\_SHA256, TLS\_AES\_256\_GCM\_SHA384]

2026-04-14 13:01:54.631| DEBUG | com.hivemq.client.mqtt-1-1 | c.h.c.i.s.io.netty.util.Recycler - -Dio.netty.recycler.maxCapacityPerThread: 4096

2026-04-14 13:01:54.631| DEBUG | com.hivemq.client.mqtt-1-1 | c.h.c.i.s.io.netty.util.Recycler - -Dio.netty.recycler.ratio: 820

26-04-14 13:01:54.631| DEBUG | com.hivemq.client.mqtt-1-1 | c.h.c.i.s.io.netty.util.Recycler - -Dio.netty.recycler.chunkSize: 32

2026-04-14 13:01:54.631| DEBUG | com.hivemq.client.mqtt-1-1 | c.h.c.i.s.io.netty.util.Recycler - -Dio.netty.recycler.blocking: false

2026-04-14 13:01:54.631| DEBUG | com.hivemq.client.mqtt-1-1 | c.h.c.i.s.io.netty.util.Recycler - -Dio.netty.recycler.batchFastThreadLocalOnly: true

2026-04-14 13:01:54.794| DEBUG | com.hivemq.client.mqtt-1-1 | c.h.c.i.s.i.n.handler.ssl.SslHandler - [id: 0x0af5cccc, L:/192.168.0.194:55096 - R:wss.certigo.com/208.95.250.117:443] HANDSHAKEN: protocol:TLSv1.3 cipher suite:TLS\_AES\_256\_GCM\_SHA384

2026-04-14 13:01:54.924| ERROR | RxComputationThreadPool-1 | ironbeamAPI.xAPI - accept errorcom.hivemq.client.mqtt.mqtt3.exceptions.Mqtt3DisconnectException: Exception while decoding PUBACK: fixed header flags must be 0 but were 8

Caused by: com.hivemq.client.mqtt.exceptions.MqttDecodeException: Exception while decoding PUBACK: fixed header flags must be 0 but were 8

2026-04-14 13:01:54.930| DEBUG | com.hivemq.client.mqtt-1-1 | c.h.c.i.s.i.n.buffer.PoolThreadCache - Freed 15 thread-local buffer(s) from thread: com.hivemq.client.mqtt-1-1

mqtt cli client also cannot connect.mqtt test -h `wss.certigo.com` -p 443 -V 3

MQTT 3: Could not connect MQTT 3 client - Exception while decoding CONNECT: must not receive this packet type

`https://www.hivemq.com/demos/websocket-client/` can connect to [wss.certigo.com:443](http://wss.certigo.com:443) and returns a relevant error

Connect failed: AMQJS0006E Bad Connack return code:2 Connection Refused: identifier rejected.

This is an expected behavior using the default ClientID

How can I connect to [wss.certigo.com:443](http://wss.certigo.com:443) using hivemq client library?

Regards,

---

<div class="post-metadata">

**Author:** ![hivemq-support](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/hivemq-support/32/357_2.png) [@hivemq-support](https://community.hivemq.com/u/hivemq-support)\
**Post date:** [April 14, 2026, 2:07pm UTC](https://community.hivemq.com/t/exception-while-decoding-puback-fixed-header-flags-must-be-0-but-were-8/4016/2 "2026-04-14T14:07:13Z")

</div>

Hello Boris,

Thanks for reaching out on our HiveMQ Community Forum.

You’re currently connecting to a WebSocket MQTT endpoint with a plain TCP MQTT client configuration, which is why you see decode errors like:

- Exception while decoding PUBACK: fixed header flags must be 0 but were 8
- Exception while decoding CONNECT: must not receive this packet type  
These symptoms are observed when MQTT decoders see WebSocket frames (e.g. 0x88 close frame) instead of raw MQTT packets.  
The HiveMQ Websocket Client in the browser works because it uses MQTT over WebSockets, and the broker then correctly returns a CONNACK with return code 2 (identifier rejected), which is a valid MQTT 3.1.1 response for the default client ID.

To connect with the HiveMQ Java client, you must:

- Use WebSockets, not plain TCP.
- Match SSL on/off to whatever works in the HiveMQ Websocket Client (SSL toggle).
- Provide a valid client ID that the server accepts (non-empty, within allowed length, pattern, etc.).
- (Optional but often required) Use the correct WebSocket path (commonly /mqtt, but use whatever the Websocket Client is using).

Below is a working template for MQTT 3 over WebSocket using the HiveMQ client:

```auto
import com.hivemq.client.mqtt.MqttClient;
import com.hivemq.client.mqtt.mqtt3.Mqtt3AsyncClient;

Mqtt3AsyncClient client = MqttClient.builder()
        .useMqttVersion3()
        .identifier("YourValidClientIdHere") // must be accepted by the server
        .serverHost("wss.certigo.com")
        .serverPort(443)
        // Use SSL or not based on what works in the browser Websocket client
        .sslWithDefaultConfig() // keep this if the browser uses "SSL" checked; remove if it does not
        .webSocketConfig()
            .serverPath("/mqtt") // adjust to the actual WS path if different
            .subprotocol("mqtt") // typical MQTT-over-WebSocket subprotocol
            .applyWebSocketConfig()
        .buildAsync();

// Then connect
client.connectWith()
        .cleanSession(true)
        .keepAlive(30)
        .send()
        .whenComplete((ack, throwable) -> {
            if (throwable != null) {
                throwable.printStackTrace();
            } else {
                System.out.println("Connected with CONNACK: " + ack);
            }
        });

```

Regards,  
Gil

---

<div class="post-metadata">

**Author:** ![Boris](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@Boris](https://community.hivemq.com/u/Boris)\
**Post date:** [April 14, 2026, 4:00pm UTC](https://community.hivemq.com/t/exception-while-decoding-puback-fixed-header-flags-must-be-0-but-were-8/4016/3 "2026-04-14T16:00:55Z")

</div>

Gil,  
Your answer is perfect!  
Thank you for your assistance!  
Regards,
