{"record":{"id":"94398bd19d4bb89f","repo":"chenhg5/cc-connect","slug":"new-qr-mode-does-not-accept-token-use-cc-conne","errorCode":null,"errorMessage":"new/QR mode does not accept --token; use `cc-connect weixin bind --token ...`","messagePattern":"new/QR mode does not accept --token; use `cc-connect weixin bind --token \\.\\.\\.`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/weixin.go","lineNumber":226,"sourceCode":"\tfmt.Println()\n\tfmt.Println(\"Next: run cc-connect (or restart the daemon) and send a message from WeChat to finish linking context_token.\")\n}\n\nfunc resolveWeixinSetupMode(requested, token string) (string, error) {\n\tswitch requested {\n\tcase weixinSetupModeAuto:\n\t\tif token != \"\" {\n\t\t\treturn weixinSetupModeBind, nil\n\t\t}\n\t\treturn weixinSetupModeNew, nil\n\tcase weixinSetupModeBind:\n\t\tif token == \"\" {\n\t\t\treturn \"\", errors.New(\"bind mode requires --token\")\n\t\t}\n\t\treturn weixinSetupModeBind, nil\n\tcase weixinSetupModeNew:\n\t\tif token != \"\" {\n\t\t\treturn \"\", errors.New(\"new/QR mode does not accept --token; use `cc-connect weixin bind --token ...`\")\n\t\t}\n\t\treturn weixinSetupModeNew, nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"internal: unknown mode %q\", requested)\n\t}\n}\n\ntype weixinQRLoginOptions struct {\n\tAPIBaseURL string\n\tRouteTag   string\n\tBotType    string\n\tTimeout    time.Duration\n\tQRImage    string\n\tDebug      bool\n}\n\ntype weixinQRLoginResult struct {\n\tBotToken    string","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/weixin.go#L208-L244","documentation":"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.","triggerScenarios":"Running `cc-connect weixin setup --mode new --token <token>` (or default setup with --token but without bind mode).","commonSituations":"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.","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"],"exampleFix":"// before\ncc-connect weixin setup --mode new --token wx_abc123\n// after\ncc-connect weixin setup --mode new","handlingStrategy":"validation","validationCode":"if mode == \"new\" && token != \"\" {\n    return errors.New(\"drop --token for new/QR setup\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["weixin","setup","cli","conflicting-flags"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}