unacceptable protocol version API Origin: Application & API OSI layer 4 · Transport Last updated 2 Dec 2026

MQTT: Connection refused: unacceptable protocol version / identifier rejected

The broker does not accept the protocol version or client ID the client offered.

Exact message you may see unacceptable protocol versionMQTT identifier rejectedConnection refused: bad protocol
Seen on: MQTT

Meaning

Return code 1 is "unacceptable protocol version" (client speaks MQTT 5 to a 3.1 broker, or the reverse), and code 2 "identifier rejected" (bad or duplicate client ID).

Common causes

  • Client uses MQTT 5 against an MQTT 3.1.1-only broker
  • Empty or too long client ID
  • Duplicate client ID kicks the older connection
  • TLS port used for plain MQTT

⚡ Quick fix

  1. Set the protocol version explicitly
  2. Use a unique, valid client ID
  3. Match ports (1883 plain, 8883 TLS)

Detailed fix by platform

Python paho

  1. mqtt.Client(client_id="dev-1", protocol=mqtt.MQTTv311)

How to diagnose

  1. Version — Both sides?
  2. ID — Unique and valid?
  3. Port — Plain or TLS?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.