{"record":{"id":"cfff4edbf342b387","repo":"nsqio/nsq","slug":"missing-arg-channel","errorCode":"MISSING_ARG_CHANNEL","errorMessage":"MISSING_ARG_CHANNEL","messagePattern":"MISSING_ARG_CHANNEL","errorType":"http","errorClass":"http_api.Err","httpStatus":400,"severity":"error","filePath":"internal/http_api/topic_channel_args.go","lineNumber":25,"sourceCode":")\n\ntype getter interface {\n\tGet(key string) (string, error)\n}\n\nfunc GetTopicChannelArgs(rp getter) (string, string, error) {\n\ttopicName, err := rp.Get(\"topic\")\n\tif err != nil {\n\t\treturn \"\", \"\", errors.New(\"MISSING_ARG_TOPIC\")\n\t}\n\n\tif !protocol.IsValidTopicName(topicName) {\n\t\treturn \"\", \"\", errors.New(\"INVALID_ARG_TOPIC\")\n\t}\n\n\tchannelName, err := rp.Get(\"channel\")\n\tif err != nil {\n\t\treturn \"\", \"\", errors.New(\"MISSING_ARG_CHANNEL\")\n\t}\n\n\tif !protocol.IsValidChannelName(channelName) {\n\t\treturn \"\", \"\", errors.New(\"INVALID_ARG_CHANNEL\")\n\t}\n\n\treturn topicName, channelName, nil\n}\n","sourceCodeStart":7,"sourceCodeEnd":34,"githubUrl":"https://github.com/nsqio/nsq/blob/85cf10c09c6c3c86160d6f0eb156f62d0efc1648/internal/http_api/topic_channel_args.go#L7-L34","documentation":"GetTopicChannelArgs requires the 'channel' query parameter on every channel-oriented HTTP endpoint. If the key is absent, rp.Get(\"channel\") errors and MISSING_ARG_CHANNEL is returned; the handler responds 400 Bad Request. Topic is validated first, so a bad topic is reported before a missing channel.","triggerScenarios":"Calling endpoints like /channel/create, /channel/delete, /channel/pause, /channel/unpause, /channel/empty with ?topic=... but no channel parameter, e.g. curl 'http://127.0.0.1:4151/channel/pause?topic=orders'. An empty channel= value fails the name check instead, not this error.","commonSituations":"Assuming nsqd has a 'default' channel; scripts parameterized only by topic; refactoring client code that previously targeted topic-only endpoints like /topic/create.","solutions":["Add the channel parameter: ?topic=<topic>&channel=<channel>.","Verify the parameter name is exactly 'channel' (case-sensitive).","Create the channel first with /channel/create if it does not exist yet, including the channel argument."],"exampleFix":"# before\ncurl -X POST 'http://127.0.0.1:4151/channel/pause?topic=orders'\n# after\ncurl -X POST 'http://127.0.0.1:4151/channel/pause?topic=orders&channel=archive'","handlingStrategy":"validation","validationCode":"if topic == \"\" || channel == \"\" {\n\treturn errors.New(\"channel admin calls require both topic and channel parameters\")\n}\nq := url.Values{\"topic\": {topic}, \"channel\": {channel}}","typeGuard":null,"tryCatchPattern":"if resp.StatusCode == 400 && strings.Contains(string(body), \"MISSING_ARG_CHANNEL\") {\n\treturn fmt.Errorf(\"request builder bug: channel parameter missing: %s\", body)\n}","preventionTips":["Route every channel-management HTTP call through one typed helper taking (topic, channel) so neither can be forgotten.","Remember NSQ has no default channel - always name it explicitly."],"tags":["nsq","http-api","validation","nsqd"],"backgroundTag":null,"analyzedSha":"85cf10c09c6c3c86160d6f0eb156f62d0efc1648","analyzedAt":"2026-08-16T00:53:05.009Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}