sipeed/picoclaw · critical

irc nick is required

Error message

irc nick is required

What it means

Constructor validation error from NewIRCChannel: IRCSettings.Nick is empty, so the channel cannot be built. IRC requires a nickname for registration (NICK/USER handshake); without one, every connect attempt would be malformed. Fail-fast at construction instead.

Source

Thrown at pkg/channels/irc/irc.go:34

)

// IRCChannel implements the Channel interface for IRC servers.
type IRCChannel struct {
	*channels.BaseChannel
	bc     *config.Channel
	config *config.IRCSettings
	conn   *ircevent.Connection
	ctx    context.Context
	cancel context.CancelFunc
}

// NewIRCChannel creates a new IRC channel.
func NewIRCChannel(bc *config.Channel, cfg *config.IRCSettings, messageBus *bus.MessageBus) (*IRCChannel, error) {
	if cfg.Server == "" {
		return nil, fmt.Errorf("irc server is required")
	}
	if cfg.Nick == "" {
		return nil, fmt.Errorf("irc nick is required")
	}

	base := channels.NewBaseChannel("irc", cfg, messageBus, bc.AllowFrom,
		channels.WithMaxMessageLength(400),
		channels.WithGroupTrigger(bc.GroupTrigger),
		channels.WithReasoningChannelID(bc.ReasoningChannelID),
	)

	return &IRCChannel{
		BaseChannel: base,
		bc:          bc,
		config:      cfg,
	}, nil
}

// Start connects to the IRC server and begins listening.
func (c *IRCChannel) Start(ctx context.Context) error {
	logger.InfoC("irc", "Starting IRC channel")

View on GitHub (pinned to 49183d7e8d)

Solutions

  1. Set nick (json key 'nick' or env PICOCLAW_CHANNELS_IRC_NICK), e.g. "mybot".
  2. Pick a unique nick to avoid 433 collisions; consider appending -[0-9] variants if the network is busy.
  3. Verify the env var is actually exported into the service's environment.
  4. Lint required IRC fields (server AND nick) in CI.

Example fix

# before
{ "type": "irc", "settings": { "server": "irc.libera.chat:6697" } }

# after
{ "type": "irc", "settings": { "server": "irc.libera.chat:6697", "nick": "mybot" } }
Defensive patterns

Strategy: validation

Validate before calling

if cfg.Nick == "" {
    return nil, fmt.Errorf("irc settings incomplete: 'nick' is required")
}
if len(cfg.Nick) > 30 || strings.ContainsAny(cfg.Nick, " #&!*?,@") {
    return nil, fmt.Errorf("nick %q is not a valid IRC nickname", cfg.Nick)
}

Try / catch

if _, err := irc.NewIRCChannel(bc, cfg, messageBus); err != nil {
    log.Fatalf("channel config invalid: %v", err) // config error: fix before deploy
}

Prevention

When it happens

Trigger: An irc channel entry is configured with a server but no nick — missing 'nick' key in JSON settings or unset PICOCLAW_CHANNELS_IRC_NICK env var.

Common situations: Copy-pasted config template with placeholders left empty; nick stored in a secret manager that failed to load into env; key spelled 'nickname' or 'username' instead of 'nick'.

Related errors


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/5b50205c47187ec4. Report an issue: GitHub.