{"record":{"id":"57616fcc2c88f33d","repo":"nats-io/nats-server","slug":"processleafsub-parse-error-s","errorCode":null,"errorMessage":"processLeafSub Parse Error: '%s'","messagePattern":"processLeafSub Parse Error: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/leafnode.go","lineNumber":2961,"sourceCode":"\tsub := &subscription{client: c, leaf: true}\n\n\tdelta := int32(1)\n\tswitch len(args) {\n\tcase 1:\n\t\tsub.queue = nil\n\tcase 3:\n\t\tsub.queue = args[1]\n\t\tsub.qw = int32(parseSize(args[2]))\n\t\t// TODO: (ik) We should have a non empty queue name and a queue\n\t\t// weight >= 1. For 2.11, we may want to return an error if that\n\t\t// is not the case, but for now just overwrite `delta` if queue\n\t\t// weight is greater than 1 (it is possible after a reconnect/\n\t\t// server restart to receive a queue weight > 1 for a new sub).\n\t\tif sub.qw > 1 {\n\t\t\tdelta = sub.qw\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"processLeafSub Parse Error: '%s'\", arg)\n\t}\n\tsub.subject = args[0]\n\n\tc.mu.Lock()\n\tif c.isClosed() {\n\t\tc.mu.Unlock()\n\t\treturn nil\n\t}\n\n\tacc := c.acc\n\t// Guard against LS+ arriving before CONNECT has been processed, which\n\t// can happen when compression is enabled.\n\tif acc == nil {\n\t\tc.mu.Unlock()\n\t\tc.sendErr(\"Authorization Violation\")\n\t\tc.closeConnection(ProtocolViolation)\n\t\treturn nil\n\t}","sourceCodeStart":2943,"sourceCodeEnd":2979,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/leafnode.go#L2943-L2979","documentation":"Leaf-node protocol parse guard: an incoming subscription line from the hub had an argument count other than 1 (plain sub) or 3 (queue sub with weight), so the arguments cannot be interpreted as a subscription.","triggerScenarios":"Thrown at server/leafnode.go:2961 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check for version mismatch between leaf nodes","Inspect the raw protocol traffic for corruption or non-NATS intermediaries","Reproduce with debug logging to capture the malformed 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"}