{"record":{"id":"768f563ab65dc81a","repo":"nats-io/nats-server","slug":"parse-error-s","errorCode":null,"errorMessage":"parse error: '%s'","messagePattern":"parse error: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/route.go","lineNumber":1404,"sourceCode":"\t\tsubjIdx     int\n\t)\n\t// If `hasOrigin` is true, then it means this is a LS- with origin in proto.\n\tif hasOrigin {\n\t\t// We would not be here if there was not at least 1 field.\n\t\torigin = args[0]\n\t\tsubjIdx = 1\n\t}\n\t// If there is an account in the protocol, bump the subject index.\n\tif accInProto {\n\t\tsubjIdx++\n\t}\n\n\tswitch len(args) {\n\tcase subjIdx + 1:\n\tcase subjIdx + 2:\n\t\tqueue = args[subjIdx+1]\n\tdefault:\n\t\treturn nil, _EMPTY_, nil, nil, fmt.Errorf(\"parse error: '%s'\", arg)\n\t}\n\tif accInProto {\n\t\t// If there is an account in the protocol, it is before the subject.\n\t\taccountName = string(args[subjIdx-1])\n\t}\n\treturn origin, accountName, args[subjIdx], queue, nil\n}\n\n// Indicates no more interest in the given account/subject for the remote side.\nfunc (c *client) processRemoteUnsub(arg []byte, leafUnsub bool) (err error) {\n\tsrv := c.srv\n\tif srv == nil {\n\t\treturn nil\n\t}\n\n\tvar accountName string\n\t// Assume the account will be in the protocol.\n\taccInProto := true","sourceCodeStart":1386,"sourceCodeEnd":1422,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/route.go#L1386-L1422","documentation":"parseUnsubProto validates the argument count of an inbound UNSUB protocol line from a remote (route/leaf) connection: after the subject (and optional account/origin), only an optional queue name may follow. Any additional fields make the line unparseable and the server returns this generic 'parse error'.","triggerScenarios":"UNSUB line with too many fields, e.g. 'UNSUB <sid> <maxmsgs> <extra>' when forwarded remotely, or a subject+queue plus unexpected extra tokens.","commonSituations":"Leaf/route connections from third-party or older implementations that append extra fields to UNSUB, protocol translation bugs in bridges, or corrupted frames.","solutions":["Emit UNSUB as 'UNSUB <sid>[ <maxmsgs>]' with no extra fields on remote links","Update the leaf/route peer client or bridge to a spec-compliant version","Enable trace logging to capture the offending UNSUB line","Verify account/origin sentinel placement matches the negotiated protocol features"],"exampleFix":"// before (bridge)\n\"UNSUB sid 1 extra\\r\\n\"\n// after\n\"UNSUB sid 1\\r\\n\"","handlingStrategy":"validation","validationCode":"// Validate UNSUB line shape before forwarding on a remote link\nparts := strings.Fields(line)\nif len(parts) > 3 { // UNSUB sid [maxmsgs] plus optional queue per remote protocol\n    return fmt.Errorf(\"too many fields in remote UNSUB: %v\", parts)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Emit UNSUB with only sid and optional max-msgs","Keep leaf/route peers updated to spec-compliant versions","Trace-verify forwarded UNSUB lines in integration tests"],"tags":["nats-server","protocol","unsub","leaf-nodes"],"backgroundTag":"malformed-protocol-frame","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}