{"record":{"id":"51e7d99323108bea","repo":"nats-io/nats-server","slug":"processleafheadermsgargs-bad-or-missing-header-siz","errorCode":null,"errorMessage":"processLeafHeaderMsgArgs Bad or Missing Header Size: '%s'","messagePattern":"processLeafHeaderMsgArgs Bad or Missing Header Size: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/leafnode.go","lineNumber":3211,"sourceCode":"\t\t\treturn fmt.Errorf(\"processLeafHeaderMsgArgs Bad or Missing Reply Indicator: '%s'\", args[1])\n\t\t}\n\t\t// Grab header size.\n\t\tc.pa.hdb = args[len(args)-2]\n\t\tc.pa.hdr = parseSize(c.pa.hdb)\n\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)-2]\n\t\t} else {\n\t\t\tc.pa.queues = args[2 : len(args)-2]\n\t\t}\n\t}\n\tif c.pa.hdr < 0 {\n\t\treturn fmt.Errorf(\"processLeafHeaderMsgArgs Bad or Missing Header Size: '%s'\", arg)\n\t}\n\tif c.pa.size < 0 {\n\t\treturn fmt.Errorf(\"processLeafHeaderMsgArgs Bad or Missing Size: '%s'\", args)\n\t}\n\tif c.pa.hdr > c.pa.size {\n\t\treturn fmt.Errorf(\"processLeafHeaderMsgArgs Header Size larger then TotalSize: '%s'\", arg)\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}","sourceCodeStart":3193,"sourceCodeEnd":3229,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/leafnode.go#L3193-L3229","documentation":"Leaf-node protocol parse guard: parseSize returned a negative value for the header-size token (missing, non-numeric, or int64 overflow), which the comment in client.go attributes to a malformed or oversized header size field.","triggerScenarios":"Thrown at server/leafnode.go:3211 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the sender encodes the header size correctly","Check for integer overflow in oversized messages","Inspect the raw protocol line for corruption"],"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"}