nats-io/nats-server · error

processRoutedMsgArgs Bad or Missing Reply Indicator: '%s'

Error message

processRoutedMsgArgs Bad or Missing Reply Indicator: '%s'

What it means

For routed MSG lines with more than 4 args (queue-group form), args[2] must be a single-byte reply indicator: '+' (reply present) or '|' (no reply). Any other content or length fails the parse. This keeps the routed message wire format unambiguous.

Source

Thrown at server/route.go:424

	c.pa.arg = arg
	switch len(args) {
	case 0, 1, 2:
		return fmt.Errorf("processRoutedMsgArgs Parse Error: '%s'", args)
	case 3:
		c.pa.reply = nil
		c.pa.queues = nil
		c.pa.szb = args[2]
		c.pa.size = parseSize(args[2])
	case 4:
		c.pa.reply = args[2]
		c.pa.queues = nil
		c.pa.szb = args[3]
		c.pa.size = parseSize(args[3])
	default:
		// args[2] is our reply indicator. Should be + or | normally.
		if len(args[2]) != 1 {
			return fmt.Errorf("processRoutedMsgArgs Bad or Missing Reply Indicator: '%s'", args[2])
		}
		switch args[2][0] {
		case '+':
			c.pa.reply = args[3]
		case '|':
			c.pa.reply = nil
		default:
			return fmt.Errorf("processRoutedMsgArgs Bad or Missing Reply Indicator: '%s'", args[2])
		}
		// 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[4 : len(args)-1]
		} else {
			c.pa.queues = args[3 : len(args)-1]

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Emit exactly '+' or '|' as args[2] in routed MSG lines
  2. If a reply subject is needed, put it in args[3] after the '+' indicator
  3. Enable protocol tracing to capture the offending line and identify the sender
  4. Verify no intermediary rewrites or splits protocol lines

Example fix

// before
"MSG foo myreply 10\r\n" // reply subject where indicator expected
// after
"MSG foo + myreply 10\r\n"
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the reply indicator is exactly + or |
if indicator != "+" && indicator != "|" {
    return fmt.Errorf("reply indicator must be + or |, got %q", indicator)
}

Prevention

When it happens

Trigger: A routed MSG with 5+ args where the third field is not exactly '+' or '|' (e.g. an empty field, a subject fragment, or a full reply subject placed where the indicator belongs).

Common situations: Hand-written protocol emulators, custom queue-group-aware bridges, or corruption of the cluster stream that shifts field boundaries.

Related errors


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