nsqio/nsq · error · http_api.Err

MISSING_ARG_CHANNEL

MISSING_ARG_CHANNEL

Error message

MISSING_ARG_CHANNEL

What it means

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.

Source

Thrown at internal/http_api/topic_channel_args.go:25

)

type getter interface {
	Get(key string) (string, error)
}

func GetTopicChannelArgs(rp getter) (string, string, error) {
	topicName, err := rp.Get("topic")
	if err != nil {
		return "", "", errors.New("MISSING_ARG_TOPIC")
	}

	if !protocol.IsValidTopicName(topicName) {
		return "", "", errors.New("INVALID_ARG_TOPIC")
	}

	channelName, err := rp.Get("channel")
	if err != nil {
		return "", "", errors.New("MISSING_ARG_CHANNEL")
	}

	if !protocol.IsValidChannelName(channelName) {
		return "", "", errors.New("INVALID_ARG_CHANNEL")
	}

	return topicName, channelName, nil
}

View on GitHub (pinned to 85cf10c09c)

Solutions

  1. Add the channel parameter: ?topic=<topic>&channel=<channel>.
  2. Verify the parameter name is exactly 'channel' (case-sensitive).
  3. Create the channel first with /channel/create if it does not exist yet, including the channel argument.

Example fix

# before
curl -X POST 'http://127.0.0.1:4151/channel/pause?topic=orders'
# after
curl -X POST 'http://127.0.0.1:4151/channel/pause?topic=orders&channel=archive'
Defensive patterns

Strategy: validation

Validate before calling

if topic == "" || channel == "" {
	return errors.New("channel admin calls require both topic and channel parameters")
}
q := url.Values{"topic": {topic}, "channel": {channel}}

Try / catch

if resp.StatusCode == 400 && strings.Contains(string(body), "MISSING_ARG_CHANNEL") {
	return fmt.Errorf("request builder bug: channel parameter missing: %s", body)
}

Prevention

When it happens

Trigger: 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.

Common situations: Assuming nsqd has a 'default' channel; scripts parameterized only by topic; refactoring client code that previously targeted topic-only endpoints like /topic/create.

Related errors


AI-assisted analysis of nsqio/nsq@85cf10c09c (2026-08-16). Data as JSON: /api/errors/cfff4edbf342b387. Report an issue: GitHub.