IMD SolutionComputing LibraryShop main store

Troubleshooting

Why MQTT Engine rejects a ClientID over 23 characters

Edge computing and IIoT Published 6 min read By IMD Solution engineering team

Short answer

MQTT Engine 4.0.6 and earlier stops the connection before any MQTT packet when a ClientID typed into Server Settings exceeds 23 characters, and the gateway log does not name the cause. Shorten the ID, or upgrade to 4.0.7 on Ignition 8 or 3.4.12 on Ignition 7, which accept longer user-specified IDs; the broker's own policy then decides, because the MQTT specification only obliges servers to accept 1 to 23.

On this page
  1. Where a long ClientID stops the connection
  2. Check the length and the module version first
  3. Worked example: counting a 24-character ClientID on 4.0.6
  4. When a short ID still fails, check the characters
  5. After the upgrade, the broker's cap is the next wall
  6. Fix procedure
  7. Pitfalls that recur with ClientID changes
  8. Questions asked

MQTT Engine 4.0.6 and earlier on Ignition 8 refuses to create the connection when a ClientID typed into Server Settings runs past 23 characters: a 23-character ID connects, a 24-character one fails, and the gateway log does not name the length as the cause. The fix is to shorten the ID to the ceiling, or to upgrade to MQTT Engine 4.0.7 on Ignition 8 or 3.4.12 on Ignition 7, which accept longer user-specified IDs. After the upgrade the broker's own policy decides, because the MQTT specification only obliges a server to accept identifiers of 1 to 23 characters. Count the string before reading anything else in the log.

Where a long ClientID stops the connection #

The ClientID travels in the CONNECT packet, the first MQTT packet of a session. On the failing module versions it never gets that far: the module refuses to build the connection, so no packet exists for the broker to accept or reject. The hops:

Hop What happens Where a long ClientID matters
Server Settings page, Engine web UI The ClientID text box accepts any string, with no length validation Nothing warns you at entry
Engine module Builds the connection from the configured ClientID On 4.0.6 and earlier an over-length user-typed ID stops the connection; the refusal was removed in 4.0.7 and 3.4.12
TCP session to the broker Uses the address and port from the server entry Not involved; a failure here shows as a socket error
Broker CONNECT handling Validates the ClientID it receives Must accept 1 to 23 characters, may accept longer; its own cap applies once the Engine actually sends the ID

Two strings that differ by one character therefore part company at the module hop, before the broker is ever involved.

Check the length and the module version first #

  • The saved ClientID, copied exactly. Copy it out of the server entry rather than retyping it, or you count your typo instead of the saved string.
  • The installed module version. Read it from the gateway module list; the failure was seen on 4.0.6.
  • The character count. Any character counter works; the example below uses PowerShell.

With those three in hand, the outcome is mechanical:

ClientID length Engine version Outcome Next step
At or below the ceiling Any Length is not the cause Check the characters, then the broker
Above the ceiling Ignition 8, below 4.0.7 (failure seen on 4.0.6) The Engine stops the connection Shorten the ID or upgrade
Above the ceiling Ignition 7, below 3.4.12 The Engine stops the connection Shorten the ID or upgrade
Above the ceiling 4.0.7 or 3.4.12 and later The Engine sends it The broker's own policy decides

Once length is cleared, what remains - credentials, TLS, the character set, broker policy - fails at the handshake, and diagnosing the MQTT handshake when TCP already works walks that path.

Worked example: counting a 24-character ClientID on 4.0.6 #

Run the failing case end to end.

Inputs, with their sources:

  • Failing ClientID: 012345678901234567890123 - the string that failed in the reported case.
  • Working ClientID: 01234567890123456789012 - from the same case; this one connected.
  • Module version: 4.0.6 on Ignition 8 - the version that case ran on.
  • Ceiling for user-specified IDs on that version: 23 characters - module behavior, removed in 4.0.7 and 3.4.12.
  • Specification floor: a server must accept 1 to 23 characters - the MQTT specification.

The rule, in words: on 4.0.6 and earlier, a user-typed ClientID longer than the ceiling never leaves the module; the connection is refused on the client side before any MQTT packet exists. The whole test is one comparison: the string's length against the ceiling.

The arithmetic:

'01234567890123456789012'.Length   # 23 -> connects on 4.0.6
'012345678901234567890123'.Length  # 24 -> fails on 4.0.6

Failing string: 24 - 23 = 1 character over the ceiling. Working string: 23 - 23 = 0 over - exactly at the ceiling, which still passes.

Result: the two strings differ by one trailing digit, and that single character is the entire fault.

Decision: at 24 or more characters on a module below 4.0.7 (Ignition 8) or below 3.4.12 (Ignition 7), length is the cause - shorten the ID to the ceiling or upgrade. At the ceiling or below, length is innocent; move to the character check.

When a short ID still fails, check the characters #

The failing case was first blamed on an underscore, because the string had been lengthened by adding one. One reconnect settles it: keep the underscore and cut the string to the ceiling or below. If it connects, the underscore is innocent and length was the cause. If it still fails, restrict the ClientID to 0-9a-zA-Z, the set the specification obliges a server to accept; a stricter broker may reject other characters independently of length. A pass on the restricted set points at the broker's own ClientID rules, not at the Engine.

After the upgrade, the broker's cap is the next wall #

The module fix removes only the client-side refusal. A broker that implements nothing beyond the specification minimum rejects an over-length ID at CONNECT, and the Engine reports a failed connection with the same lack of a clear message. Read the broker's own log for the rejected CONNECT and look in its configuration for a maximum ClientID length setting; a broker capped at the minimum keeps that cap whatever module version you run, so the ID gets shortened there. Cloud endpoints add their own connection rules on top - one worked case of modules failing at a cloud broker is why MQTT Transmission fails when MQTT Engine connects to AWS IoT Core.

Fix procedure #

  1. Shorten the ClientID in the Engine's Server Settings to the ceiling or below. This is the immediate fix and needs no module change.
  2. Keep the ID unique per connecting client.
  3. If a naming standard requires a longer ID, upgrade MQTT Engine to 4.0.7 or later on Ignition 8, or 3.4.12 or later on Ignition 7. Take the module from the Ignition third-party module downloads page for your gateway version, which lists the module version beside the file.
  4. Re-enter the long ClientID and save the server entry.
  5. Confirm the broker accepts the length - its log shows the CONNECT accepted - before rolling the change to other gateways.

Schedule the change for a quiet window: the feed from that server interrupts until the new session is up.

Pitfalls that recur with ClientID changes #

  • The ceiling is sometimes quoted one character high; the measured behavior on 4.0.6 is that a string at the ceiling connects and one more character fails, so trust the count you ran over the quoted number.
  • Changing the ClientID changes the session identity at the broker, so persistent-session state stored under the old ID is not carried over.
  • A saved server entry shows no field-level error, so a mistyped ID and an over-length one look identical at connect; the character count separates them.

Questions asked

Does the ceiling apply to ClientIDs the Engine generates itself?

No. The ClientIDs the module generates programmatically for its internal clients stay under the ceiling even on the fixed versions, so this failure only touches IDs typed into Server Settings. If a server entry uses a generated ID and still will not connect, length is not the cause: check the credentials and the broker's policy instead.

Does the limit count characters or bytes?

The MQTT specification counts UTF-8 encoded bytes, and a broker that implements only the minimum counts bytes too. For the 0-9a-zA-Z set every character is exactly one byte, so counting characters gives the same number. An ID containing accented letters or other multi-byte characters can sit at or under the limit as typed and exceed it on the wire, which is one more reason to keep ClientIDs to digits and plain letters.

Why must every server entry have its own ClientID?

The broker treats one ClientID as one client. When a second connection presents an ID already in use, the broker accepts the new session and disconnects the existing one; the loser reconnects and displaces the first in turn. The symptom is a connection that flaps with no length involved, so give every connecting client a unique ID before chasing anything else.

How do I confirm I have the fixed module file?

Read the version column on the Ignition third-party module downloads page before installing: the Ignition 8.1.5 page lists MQTT Engine Module 4.0.7 at 31.3 MB. After installing, read the version back from the gateway module list, because a gateway still running the old module keeps refusing the long ID no matter which file you downloaded.

What does a packet capture show when the Engine stops the connection?

No CONNECT packet from the gateway at all, because the module refuses before it builds one; there is nothing for the broker to log or reject, and that absence is the proof the stop is on the client side. After the shortening or the upgrade, the same capture shows the CONNECT go out carrying the long ID, and any rejection from then on comes from the broker.

Keep reading

  • Troubleshooting

    MQTT Transmission connected but missing from the node list

    A connected badge only certifies the broker session; the gateway node list fills from the node's birth message and subscriptions. The compatibility matrix lists module 4.0.13 as supported on Ignition 8.1.21, so the fault sits in subscription behavior or MQTT Server ACLs. Read three logs from one attempt, repair the specific grants, and roll the new edge back to Ignition 8.1.18 with module 4.0.8 if production waits.

    Edge computing and IIoT

  • Troubleshooting

    Why an MQTT Engine UDT instance shows up as a folder

    Stop MQTT Transmission on the Edge gateway, delete the affected tags and UDT definitions from MQTT Engine, re-enable Transmission and force the refresh; Engine then rebuilds the objects as UDT instances. On the 4.0.10 builds, upgrade both MQTT modules to 4.0.16 afterwards and restart the Ignition service to clear leaked TransmissionClient threads.

    Edge computing and IIoT

  • Troubleshooting

    MQTT Engine server definition not found: the typographic quote cause

    When MQTT Engine logs no server definition found, check the startup log for a JsonParseException: a General-tab JSON value opened its field name with a typographic quote, so module startup failed before connection objects were built. Retype the value with plain quotes and restart; the brokers, the firewall and the installation were never at fault.

    Edge computing and IIoT