nats-io/nats-server · error

processRoutedOriginClusterMsgArgs Bad or Missing Size: '%s'

Error message

processRoutedOriginClusterMsgArgs Bad or Missing Size: '%s'

What it means

The total message-size token of the routed origin-cluster message failed to parse: parseSize returned a negative value for the last argument, which must be a non-negative decimal byte count. The parsed args slice is echoed; common causes are a corrupted size field or misaligned tokens from an incompatible route protocol version.

Source

Thrown at server/route.go:265

		c.pa.hdb = args[len(args)-2]
		c.pa.hdr = parseSize(c.pa.hdb)

		// Grab size.
		c.pa.szb = args[len(args)-1]
		c.pa.size = parseSize(c.pa.szb)

		// Grab queue names.
		if c.pa.reply != nil {
			c.pa.queues = args[5 : len(args)-2]
		} else {
			c.pa.queues = args[4 : len(args)-2]
		}
	}
	if c.pa.hdr < 0 {
		return fmt.Errorf("processRoutedOriginClusterMsgArgs Bad or Missing Header Size: '%s'", arg)
	}
	if c.pa.size < 0 {
		return fmt.Errorf("processRoutedOriginClusterMsgArgs Bad or Missing Size: '%s'", args)
	}
	if c.pa.hdr > c.pa.size {
		return fmt.Errorf("processRoutedOriginClusterMsgArgs Header Size larger then TotalSize: '%s'", arg)
	}

	// Common ones processed after check for arg length
	c.pa.origin = args[0]
	c.pa.account = args[1]
	c.pa.subject = args[2]
	if len(an) > 0 {
		c.pa.pacache = c.pa.subject
	} else {
		c.pa.pacache = arg[len(args[0])+1 : len(args[0])+len(args[1])+len(args[2])+2]
	}
	return nil
}

// Process an inbound HMSG specification from the remote route.

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Confirm the total size token is a valid non-negative integer
  2. Align nats-server versions across the cluster
  3. Rule out payload corruption by intermediaries (LBs, proxies) on the route connection
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/route.go:265 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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