{"record":{"id":"6a5ec415ad878f32","repo":"nats-io/nats-server","slug":"processleafmsgargs-bad-or-missing-size-s","errorCode":null,"errorMessage":"processLeafMsgArgs Bad or Missing Size: '%s'","messagePattern":"processLeafMsgArgs Bad or Missing Size: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/leafnode.go","lineNumber":3291,"sourceCode":"\t\t\tc.pa.reply = args[2]\n\t\tcase '|':\n\t\t\tc.pa.reply = nil\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"processLeafMsgArgs Bad or Missing Reply Indicator: '%s'\", args[1])\n\t\t}\n\t\t// Grab size.\n\t\tc.pa.szb = args[len(args)-1]\n\t\tc.pa.size = parseSize(c.pa.szb)\n\n\t\t// Grab queue names.\n\t\tif c.pa.reply != nil {\n\t\t\tc.pa.queues = args[3 : len(args)-1]\n\t\t} else {\n\t\t\tc.pa.queues = args[2 : len(args)-1]\n\t\t}\n\t}\n\tif c.pa.size < 0 {\n\t\treturn fmt.Errorf(\"processLeafMsgArgs Bad or Missing Size: '%s'\", args)\n\t}\n\tmaxPayload := atomic.LoadInt32(&c.mpay)\n\tif maxPayload != jwt.NoLimit && int64(c.pa.size) > int64(maxPayload) {\n\t\tc.maxPayloadViolation(c.pa.size, maxPayload)\n\t\treturn ErrMaxPayload\n\t}\n\n\t// Common ones processed after check for arg length\n\tc.pa.subject = args[0]\n\n\treturn nil\n}\n\n// processInboundLeafMsg is called to process an inbound msg from a leaf node.\nfunc (c *client) processInboundLeafMsg(msg []byte) {\n\t// Update statistics\n\t// The msg includes the CR_LF, so pull back out for accounting.\n\tc.in.msgs++","sourceCodeStart":3273,"sourceCodeEnd":3309,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/leafnode.go#L3273-L3309","documentation":"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.","triggerScenarios":"Thrown at server/leafnode.go:3291 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}