nats-io/nats-server · error
processRoutedMsgArgs Parse Error: '%s'
Error message
processRoutedMsgArgs Parse Error: '%s'
What it means
processRoutedMsgArgs parses the args of an inbound MSG protocol line from another server in the cluster. With fewer than 3 fields (no subject, reply placeholder, and size), the line cannot represent a routed message, so the parse fails. This indicates a malformed or truncated inter-server protocol frame.
Source
Thrown at server/route.go:410
case ' ', '\t', '\r', '\n':
if start >= 0 {
args = append(args, arg[start:i])
start = -1
}
default:
if start < 0 {
start = i
}
}
}
if start >= 0 {
args = append(args, arg[start:])
}
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]View on GitHub (pinned to 3a66a489d2)
Solutions
- Fix the sender to emit the full routed MSG arg list: subject, reply (or +/|), and size
- Check for stream corruption/desync on the cluster link (proxy, MTU, TLS termination issues)
- Upgrade/align NATS Server versions across the cluster
- Reproduce with protocol trace logging enabled (trace=true / -DV) to see the raw line
Example fix
// before (raw wire sender)
conn.Write([]byte("MSG foo 10\r\n"))
// after
conn.Write([]byte(fmt.Sprintf("MSG foo 10\r\n"))) // subject, empty reply, size Defensive patterns
Strategy: validation
Validate before calling
// Validate routed MSG arg count before writing to a route connection
fields := strings.Split(line, " ")
if len(fields) < 3 {
return fmt.Errorf("routed MSG needs at least subject, reply-indicator, size: %q", line)
} Prevention
- Use the official NATS client libraries rather than hand-rolled wire protocol
- Enable server trace logging in staging to catch malformed frames early
- Monitor route connections for repeated parse errors (possible desync)
When it happens
Trigger: Sending/routeing a MSG over a cluster connection with args like '<subject> <size>' only, or an empty/garbled arg string — i.e. less than subject+reply/queue marker+size fields.
Common situations: Custom bridge tools speaking raw NATS wire protocol, TCP stream desynchronization after a proxy buffer error, protocol version mismatch between servers, or fuzzing traffic.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- processRoutedHeaderMsgArgs Header Size larger then TotalSize
- processRoutedMsgArgs Bad or Missing Size: '%s'
- processRoutedMsgArgs Bad or Missing Reply Indicator: '%s'
- invalid publish message, variable header exceeds remaining l
- restore for stream '%s > %s' requires reply subject for each
AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02).
Data as JSON: /api/errors/bbe3f020361cad5b.
Report an issue: GitHub.