chenhg5/cc-connect · error
new/QR mode does not accept --token; use `cc-connect weixin
Error message
new/QR mode does not accept --token; use `cc-connect weixin bind --token ...`
What it means
The new/QR setup flow creates a fresh account pairing and is mutually exclusive with --token, which only applies to bind mode. Supplying a token to new mode raises this error with a hint pointing at the bind subcommand.
Source
Thrown at cmd/cc-connect/weixin.go:226
fmt.Println()
fmt.Println("Next: run cc-connect (or restart the daemon) and send a message from WeChat to finish linking context_token.")
}
func resolveWeixinSetupMode(requested, token string) (string, error) {
switch requested {
case weixinSetupModeAuto:
if token != "" {
return weixinSetupModeBind, nil
}
return weixinSetupModeNew, nil
case weixinSetupModeBind:
if token == "" {
return "", errors.New("bind mode requires --token")
}
return weixinSetupModeBind, nil
case weixinSetupModeNew:
if token != "" {
return "", errors.New("new/QR mode does not accept --token; use `cc-connect weixin bind --token ...`")
}
return weixinSetupModeNew, nil
default:
return "", fmt.Errorf("internal: unknown mode %q", requested)
}
}
type weixinQRLoginOptions struct {
APIBaseURL string
RouteTag string
BotType string
Timeout time.Duration
QRImage string
Debug bool
}
type weixinQRLoginResult struct {
BotToken stringView on GitHub (pinned to 4000b2338a)
Solutions
- Remove --token from the command: `cc-connect weixin setup --mode new`
- If you actually want to reuse the account, use `cc-connect weixin bind --token <token>` instead
- Confirm which flow you need: existing account -> bind with token, new account -> new/QR without token
Example fix
// before cc-connect weixin setup --mode new --token wx_abc123 // after cc-connect weixin setup --mode new
Defensive patterns
Strategy: validation
Validate before calling
if mode == "new" && token != "" {
return errors.New("drop --token for new/QR setup")
} Prevention
- Treat --token as bind-mode-only; never include it in fresh-setup scripts
- Separate setup-new and bind scripts so flags cannot leak between them
- Re-read the hint in the error message which names the correct subcommand
When it happens
Trigger: Running `cc-connect weixin setup --mode new --token <token>` (or default setup with --token but without bind mode).
Common situations: Copy-pasting a full setup command that included the token when the intent was a fresh QR pairing, or misunderstanding that token belongs exclusively to bind mode.
Understand the failure class
Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.
Related errors
- bind mode requires --token
- 等待扫码超时,请重试
- no project found in config
- multiple projects found, please specify --project (%s)
- bind mode requires --token (format: app_key:app_secret)
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/94398bd19d4bb89f.
Report an issue: GitHub.