sipeed/picoclaw · error

QQ app_id and app_secret not configured

Error message

QQ app_id and app_secret not configured

What it means

QQChannel.Start refuses to run when either config.AppID or config.AppSecret is empty. The QQ channel talks to the QQ open platform (botgo SDK), which requires an app_id/app_secret pair to mint access tokens; starting with blank credentials would only fail later with a confusing auth error, so the constructor fails fast at pkg/channels/qq/qq.go:104.

Source

Thrown at pkg/channels/qq/qq.go:104

func NewQQChannel(bc *config.Channel, cfg *config.QQSettings, messageBus *bus.MessageBus) (*QQChannel, error) {
	base := channels.NewBaseChannel("qq", cfg, messageBus, bc.AllowFrom,
		channels.WithMaxMessageLength(cfg.MaxMessageLength),
		channels.WithGroupTrigger(bc.GroupTrigger),
		channels.WithReasoningChannelID(bc.ReasoningChannelID),
	)

	return &QQChannel{
		BaseChannel: base,
		bc:          bc,
		config:      cfg,
		dedup:       make(map[string]time.Time),
		done:        make(chan struct{}),
	}, nil
}

func (c *QQChannel) Start(ctx context.Context) error {
	if c.config.AppID == "" || c.config.AppSecret.String() == "" {
		return fmt.Errorf("QQ app_id and app_secret not configured")
	}

	botgo.SetLogger(newBotGoLogger("botgo"))
	logger.InfoC("qq", "Starting QQ bot (WebSocket mode)")

	// Reinitialize shutdown signal for clean restart.
	c.done = make(chan struct{})
	c.stopOnce = sync.Once{}

	// create token source
	credentials := &token.QQBotCredentials{
		AppID:     c.config.AppID,
		AppSecret: c.config.AppSecret.String(),
	}
	c.tokenSource = token.NewQQBotTokenSource(credentials)

	// create child context
	c.ctx, c.cancel = context.WithCancel(ctx)

View on GitHub (pinned to 49183d7e8d)

Solutions

  1. Set channels.qq settings app_id and app_secret (or PICOCLAW_CHANNELS_QQ_APP_ID / corresponding secret env var) in the config file or environment.
  2. Confirm the values landed: dump the loaded config (without printing the secret value) or check AppID != "" && AppSecret.String() != "" before Start.
  3. Get the pair from the QQ open platform console (q.qq.com) for your bot application; app_id is numeric, app_secret is a long opaque string.
  4. If using env vars, verify the exact PICOCLAW_CHANNELS_QQ_* names and that the process environment actually exports them.

Example fix

# before
channels:
  qq:
    enabled: true
    # credentials missing

# after
channels:
  qq:
    enabled: true
    settings:
      app_id: "102001234"
      app_secret: "your-app-secret-from-qq-console"
Defensive patterns

Strategy: validation

Validate before calling

func qqReady(cfg *config.QQSettings) error {
    if cfg.AppID == "" || cfg.AppSecret.String() == "" {
        return fmt.Errorf("set channels.qq app_id/app_secret before start")
    }
    return nil
}
// call before qqChannel.Start(ctx)

Try / catch

// Go: if err := ch.Start(ctx); err != nil { if strings.Contains(err.Error(), "not configured") { return fmt.Errorf("deployment config incomplete: %w", err) } ... }

Prevention

When it happens

Trigger: Enabling the qq channel (channels.qq) without setting app_id / app_secret (json keys app_id, app_secret; env PICOCLAW_CHANNELS_QQ_APP_ID per pkg/config/config.go:574); leaving the secret as the empty SecureString default; typos in the env var name so the value never loads.

Common situations: Fresh installs that copied an example config with placeholder secrets; secrets provided via environment variables that are missing in systemd/Docker unit files; the secret set under the wrong YAML key or wrong channel stanza; rotating secrets and clearing the old one without writing the new one.

Related errors


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