← Back to the chapter · Previous detail · Next detail →

Technical detail · MQTT Python: Reliable Client Patterns

Selected MQTT reason-code responses

VersionValueResponseNext action
3.1.10Connection Accepted (success; Success)Subscribe to topics and begin publishing.
3.1.11Unacceptable Protocol Version (error; Protocol)Upgrade your MQTT client library to support the broker’s required version.
3.1.12Identifier Rejected (error; Identity)Use a client ID accepted by this broker. MQTT 3.1.1 requires support for IDs of 1–23 alphanumeric characters; a broker may accept others.
3.1.13Server Unavailable (warning; Server)Broker is running but cannot serve requests. Retry with exponential backoff.
3.1.14Bad Username or Password (error; Auth)Check credentials. Ensure username/password are correctly configured.
3.1.15Not Authorized (error; Auth)Client lacks ACL permissions. Contact broker administrator.
5.00Success (success; Success)Connection established. Subscribe and publish.
5.0128Unspecified Error (error; General)Generic failure. Check broker logs for details.
5.0129Malformed Packet (error; Protocol)Client sent invalid data. Update your MQTT library.
5.0130Protocol Error (error; Protocol)Protocol violation detected. Check MQTT version compatibility.
5.0131Implementation Specific Error (error; General)Broker-specific issue. Consult broker documentation.
5.0132Unsupported Protocol Version (error; Protocol)Broker does not support this MQTT version. Try MQTT 3.1.1.
5.0133Client ID Not Valid (error; Identity)Use a valid client ID. Some brokers reject empty or long IDs.
5.0134Bad Username or Password (error; Auth)Verify credentials match broker configuration.
5.0135Not Authorized (error; Auth)Client authenticated but lacks permission. Check ACLs.
5.0136Server Unavailable (warning; Server)Broker temporarily unavailable. Implement retry with backoff.
5.0137Server Busy (warning; Server)Broker overloaded. Back off and retry later.
5.0138Banned (error; Auth)Client has been banned. Contact administrator.
5.0140Bad Authentication Method (error; Auth)Use an authentication method supported by both client and broker.
5.0149Packet Too Large (warning; Packet size)Reduce the packet size or inspect the broker maximum packet size.
5.0151Quota Exceeded (warning; Server)Inspect which resource quota was exceeded; reduce demand or adjust that resource limit.
5.0159Connection Rate Exceeded (warning; Server)Slow down reconnection attempts with exponential backoff.
5.0162Wildcard Subscriptions Not Supported (error; Protocol)Broker disallows wildcards. Use explicit topic names.

← Back to the chapter · Previous detail · Next detail →