{"record":{"id":"8b67441c9069f036","repo":"nats-io/nats-server","slug":"processleafheadermsgargs-header-size-larger-then-t","errorCode":null,"errorMessage":"processLeafHeaderMsgArgs Header Size larger then TotalSize: '%s'","messagePattern":"processLeafHeaderMsgArgs Header Size larger then TotalSize: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/leafnode.go","lineNumber":3217,"sourceCode":"\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}\n\nfunc (c *client) processLeafMsgArgs(arg []byte) error {\n\t// Unroll splitArgs to avoid runtime/heap issues\n\targs := c.argsa[:0]\n\tstart := -1\n\tfor i, b := range arg {","sourceCodeStart":3199,"sourceCodeEnd":3235,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/leafnode.go#L3199-L3235","documentation":"Leaf-node protocol parse guard: the parsed header size exceeds the parsed total message size in an incoming header message, which is inconsistent and indicates a malformed or corrupted protocol line.","triggerScenarios":"Thrown at server/leafnode.go:3217 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check protocol corruption or a buggy peer emitting wrong sizes","Verify intermediaries do not truncate protocol lines","Capture the offending line via trace logging"],"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"}