{"record":{"id":"ff35a6b509577c67","repo":"nats-io/nats-server","slug":"processroutedmsgargs-bad-or-missing-reply-indicato","errorCode":null,"errorMessage":"processRoutedMsgArgs Bad or Missing Reply Indicator: '%s'","messagePattern":"processRoutedMsgArgs Bad or Missing Reply Indicator: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/route.go","lineNumber":424,"sourceCode":"\n\tc.pa.arg = arg\n\tswitch len(args) {\n\tcase 0, 1, 2:\n\t\treturn fmt.Errorf(\"processRoutedMsgArgs Parse Error: '%s'\", args)\n\tcase 3:\n\t\tc.pa.reply = nil\n\t\tc.pa.queues = nil\n\t\tc.pa.szb = args[2]\n\t\tc.pa.size = parseSize(args[2])\n\tcase 4:\n\t\tc.pa.reply = args[2]\n\t\tc.pa.queues = nil\n\t\tc.pa.szb = args[3]\n\t\tc.pa.size = parseSize(args[3])\n\tdefault:\n\t\t// args[2] is our reply indicator. Should be + or | normally.\n\t\tif len(args[2]) != 1 {\n\t\t\treturn fmt.Errorf(\"processRoutedMsgArgs Bad or Missing Reply Indicator: '%s'\", args[2])\n\t\t}\n\t\tswitch args[2][0] {\n\t\tcase '+':\n\t\t\tc.pa.reply = args[3]\n\t\tcase '|':\n\t\t\tc.pa.reply = nil\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"processRoutedMsgArgs Bad or Missing Reply Indicator: '%s'\", args[2])\n\t\t}\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[4 : len(args)-1]\n\t\t} else {\n\t\t\tc.pa.queues = args[3 : len(args)-1]","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/route.go#L406-L442","documentation":"For routed MSG lines with more than 4 args (queue-group form), args[2] must be a single-byte reply indicator: '+' (reply present) or '|' (no reply). Any other content or length fails the parse. This keeps the routed message wire format unambiguous.","triggerScenarios":"A routed MSG with 5+ args where the third field is not exactly '+' or '|' (e.g. an empty field, a subject fragment, or a full reply subject placed where the indicator belongs).","commonSituations":"Hand-written protocol emulators, custom queue-group-aware bridges, or corruption of the cluster stream that shifts field boundaries.","solutions":["Emit exactly '+' or '|' as args[2] in routed MSG lines","If a reply subject is needed, put it in args[3] after the '+' indicator","Enable protocol tracing to capture the offending line and identify the sender","Verify no intermediary rewrites or splits protocol lines"],"exampleFix":"// before\n\"MSG foo myreply 10\\r\\n\" // reply subject where indicator expected\n// after\n\"MSG foo + myreply 10\\r\\n\"","handlingStrategy":"validation","validationCode":"// Ensure the reply indicator is exactly + or |\nif indicator != \"+\" && indicator != \"|\" {\n    return fmt.Errorf(\"reply indicator must be + or |, got %q\", indicator)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Follow the NATS wire protocol spec for routed MSG queue-group lines","Test custom bridges against a real NATS cluster before production","Never place a reply subject where the single-char indicator belongs"],"tags":["nats-server","protocol","routing","queue-groups"],"backgroundTag":"malformed-protocol-frame","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}