nats-io/nats-server · error
processLeafMsgArgs Bad or Missing Size: '%s'
Error message
processLeafMsgArgs Bad or Missing Size: '%s'
What it means
Returned by processLeafMsgArgs when the size token of a leaf-node MSG protocol line parses to a negative number (parseSize failed on the last argument, e.g. a truncated or malformed payload length). The raw args slice is included so the offending control line can be inspected.
Source
Thrown at server/leafnode.go:3291
c.pa.reply = args[2]
case '|':
c.pa.reply = nil
default:
return fmt.Errorf("processLeafMsgArgs Bad or Missing Reply Indicator: '%s'", args[1])
}
// 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[3 : len(args)-1]
} else {
c.pa.queues = args[2 : len(args)-1]
}
}
if c.pa.size < 0 {
return fmt.Errorf("processLeafMsgArgs Bad or Missing Size: '%s'", args)
}
maxPayload := atomic.LoadInt32(&c.mpay)
if maxPayload != jwt.NoLimit && int64(c.pa.size) > int64(maxPayload) {
c.maxPayloadViolation(c.pa.size, maxPayload)
return ErrMaxPayload
}
// Common ones processed after check for arg length
c.pa.subject = args[0]
return nil
}
// processInboundLeafMsg is called to process an inbound msg from a leaf node.
func (c *client) processInboundLeafMsg(msg []byte) {
// Update statistics
// The msg includes the CR_LF, so pull back out for accounting.
c.in.msgs++View on GitHub (pinned to 3a66a489d2)
Solutions
- Fix the leaf node operator's client/server so it sends a well-formed MSG proto with a non-negative size token
- Capture the full control line from the error and check for proxy or protocol corruption between the leaf node and the cluster
- Verify max_payload negotiation is not truncating the protocol line
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/leafnode.go:3291 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/6a5ec415ad878f32.
Report an issue: GitHub.