nats-io/nats-server · error

older protocol %q not supported

Error message

older protocol %q not supported

What it means

Returned when the CONNECT packet's protocol name does not match the supported "MQTT" name and matches the old "MQIsdp" name used by MQTT 3.1. The server does not support the legacy protocol and reports this specific, clearer error instead of a generic protocol-name mismatch.

Source

Thrown at server/mqtt.go:3798

//////////////////////////////////////////////////////////////////////////////
//
// CONNECT protocol related functions
//
//////////////////////////////////////////////////////////////////////////////

// Parse the MQTT connect protocol
func (c *client) mqttParseConnect(r *mqttReader, hasMappings bool) (byte, *mqttConnectProto, error) {
	// Protocol name
	proto, err := r.readBytes("protocol name", false)
	if err != nil {
		return 0, nil, err
	}

	// Spec [MQTT-3.1.2-1]
	if !bytes.Equal(proto, mqttProtoName) {
		// Check proto name against v3.1 to report better error
		if bytes.Equal(proto, mqttOldProtoName) {
			return 0, nil, fmt.Errorf("older protocol %q not supported", proto)
		}
		return 0, nil, fmt.Errorf("expected connect packet with protocol name %q, got %q", mqttProtoName, proto)
	}

	// Protocol level
	level, err := r.readByte("protocol level")
	if err != nil {
		return 0, nil, err
	}
	// Spec [MQTT-3.1.2-2]
	if level != mqttProtoLevel {
		return mqttConnAckRCUnacceptableProtocolVersion, nil, fmt.Errorf("unacceptable protocol version of %v", level)
	}

	cp := &mqttConnectProto{}
	// Connect flags
	cp.flags, err = r.readByte("flags")
	if err != nil {

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Upgrade the client library/firmware to use MQTT 3.1.1 or 3.1.2+ (protocol name "MQTT", level 4 or 5)
  2. Reconfigure the client's protocol name/level (e.g. Paho: set MQTT_VERSION to 3_1_1 or 5)
  3. If the device cannot be updated, place a protocol-translating bridge in front of the broker
  4. Confirm the emitted CONNECT bytes: protoName must be "MQTT" not "MQIsdp"

Example fix

// before
opts := mqtt.NewClientOptions().SetProtocolVersion(3) // MQIsdp
// after
opts := mqtt.NewClientOptions().SetProtocolVersion(4) // MQTT 3.1.1
Defensive patterns

Strategy: validation

Validate before calling

// Validate protocol name/version before connecting (client side)
if (opts.protocolVersion === 3 || opts.protocolName === 'MQIsdp') {
  throw new Error('MQTT 3.1 (MQIsdp) is not supported; use protocol level 4 or 5')
}

Type guard

function isSupportedMqttVersion(opts) {
  return opts.protocolVersion === 4 || opts.protocolVersion === 5
}

Prevention

When it happens

Trigger: A client sends a CONNECT with protocol name "MQIsdp" (MQTT v3.1) — e.g. a very old client library or device firmware configured for protocol level 3.1 / protocol name MQIsdp.

Common situations: Legacy embedded devices or ancient Paho versions defaulting to MQIsdp; misconfigured client library set to MQTT 3.1 instead of 3.1.1/3.1.2+; hardware firmware that predates MQTT 3.1.1.

Related errors


AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02). Data as JSON: /api/errors/776a20a6aa4b760b. Report an issue: GitHub.