{"record":{"id":"24575c5f101929a2","repo":"nats-io/nats-server","slug":"processremotesub-parse-error-s","errorCode":null,"errorMessage":"processRemoteSub Parse Error: '%s'","messagePattern":"processRemoteSub Parse Error: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/route.go","lineNumber":1599,"sourceCode":"\tif accInProto {\n\t\tsubjIdx++\n\t}\n\tswitch len(args) {\n\tcase subjIdx + 1:\n\t\tsub.queue = nil\n\tcase subjIdx + 3:\n\t\tsub.queue = args[subjIdx+1]\n\t\tsub.qw = int32(parseSize(args[subjIdx+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(\"processRemoteSub Parse Error: '%s'\", arg)\n\t}\n\t// We know that the number of fields is correct. So we can access args[] based\n\t// on where we expect the fields to be.\n\n\t// If there is an origin, it will be at index 1. The negotiated sentinel\n\t// denotes leaf interest without an actual origin cluster.\n\tnoOrigin := lnSupport && hasOrigin && bytesToString(args[1]) == leafNoOriginCluster\n\tif hasOrigin && !noOrigin {\n\t\tsub.origin = args[1]\n\t}\n\t// For subject, use subjIdx.\n\tsub.subject = args[subjIdx]\n\t// If the account name is in the protocol, it will be before the subject.\n\tif accInProto {\n\t\taccountName = bytesToString(args[subjIdx-1])\n\t}\n\t// Now set the sub.sid from the arg slice. However, we will have a different\n\t// one if we use the origin or not.","sourceCodeStart":1581,"sourceCodeEnd":1617,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/route.go#L1581-L1617","documentation":"processRemoteSub parses RSUB-style subscription lines from remote connections, including queue-subscription weight fields. When the number of fields doesn't match any supported layout (the switch default), the server cannot map args to subject/queue/weight and rejects the line.","triggerScenarios":"A remote SUB/routed sub line whose field count matches none of the expected cases — e.g. missing weight, extra tokens, or a queue-sub form missing required fields.","commonSituations":"Queue subscription interest forwarded by a bridge that omits the weight field, version skew between cluster members on the extended sub protocol, or malformed synthetic traffic.","solutions":["Align protocol versions across the cluster/leaf links so all servers send the same sub-line layout","Fix the emitter to include all required fields (subject, queue name, weight, etc.)","Trace the raw line to compare against a compliant server's output","Check for stream corruption shifting field boundaries on earlier frames"],"exampleFix":"// before (bridge, queue sub without weight)\n\"RSUB origin acc subj queue\\r\\n\"\n// after\n\"RSUB origin acc subj queue 1\\r\\n\"","handlingStrategy":"validation","validationCode":"// Validate remote SUB line field count against known layouts before sending\nlayouts := map[int]bool{4: true, 5: true, 6: true} // supported arg counts\nif !layouts[len(args)] {\n    return fmt.Errorf(\"unsupported remote SUB arg count %d\", len(args))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match protocol versions across cluster members before rolling queue interest forwarding","Include the queue weight field in queue subscription lines","Add integration tests that exercise routed queue subs between mixed builds"],"tags":["nats-server","protocol","subscriptions","queue-groups"],"backgroundTag":"malformed-protocol-frame","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}