{"record":{"id":"2b2c431bf12705f0","repo":"chenhg5/cc-connect","slug":"both-app-id-and-app-secret-are-required","errorCode":null,"errorMessage":"both --app-id and --app-secret are required","messagePattern":"both --app-id and --app-secret are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/feishu.go","lineNumber":398,"sourceCode":"func resolveFeishuSetupInputs(mode, app, appID, appSecret string) (effectiveMode, resolvedAppID, resolvedAppSecret string, err error) {\n\tapp = strings.TrimSpace(app)\n\tappID = strings.TrimSpace(appID)\n\tappSecret = strings.TrimSpace(appSecret)\n\n\tif app != \"\" && (appID != \"\" || appSecret != \"\") {\n\t\treturn \"\", \"\", \"\", fmt.Errorf(\"use either --app or --app-id/--app-secret, not both\")\n\t}\n\n\tif app != \"\" {\n\t\tappID, appSecret, err = parseAppPair(app)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", \"\", err\n\t\t}\n\t}\n\n\tif appID != \"\" || appSecret != \"\" {\n\t\tif appID == \"\" || appSecret == \"\" {\n\t\t\treturn \"\", \"\", \"\", fmt.Errorf(\"both --app-id and --app-secret are required\")\n\t\t}\n\t}\n\n\teffectiveMode = mode\n\tif mode == feishuSetupModeAuto {\n\t\tif appID != \"\" && appSecret != \"\" {\n\t\t\teffectiveMode = feishuSetupModeBind\n\t\t} else {\n\t\t\teffectiveMode = feishuSetupModeNew\n\t\t}\n\t}\n\tif mode == feishuSetupModeBind && (appID == \"\" || appSecret == \"\") {\n\t\treturn \"\", \"\", \"\", fmt.Errorf(\"bind mode requires credentials: use --app id:secret or --app-id/--app-secret\")\n\t}\n\tif mode == feishuSetupModeNew && (appID != \"\" || appSecret != \"\") {\n\t\treturn \"\", \"\", \"\", fmt.Errorf(\"new mode does not accept credentials; use `cc-connect feishu bind`\")\n\t}\n","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/feishu.go#L380-L416","documentation":"After resolving the --app pair form, resolveFeishuSetupInputs checks that if either --app-id or --app-secret is present, both are. Supplying only one half would produce an unusable app credential, so the parser rejects it explicitly before mode resolution.","triggerScenarios":"`cc-connect feishu setup --app-id cli_xxx` (secret missing) or `--app-secret xxx` (app id missing). Often the other half was expected from env/config but was not picked up by this parser.","commonSituations":"Secrets kept out of shell history and passed via env vars that this command does not read, copy-paste truncation of the secret, or a script where the second flag failed to interpolate.","solutions":["Pass both flags together: --app-id X --app-secret Y","Verify the missing half is non-empty in the calling script (echo/printf to check interpolation)","Use the combined form --app id:secret instead"],"exampleFix":"// before\ncc-connect feishu setup --app-id \"$APP_ID\"   # APP_SECRET not passed\n// after\ncc-connect feishu setup --app-id \"$APP_ID\" --app-secret \"$APP_SECRET\"","handlingStrategy":"validation","validationCode":"if [[ ( -n \"$APP_ID\" || -n \"$APP_SECRET\" ) && ( -z \"$APP_ID\" || -z \"$APP_SECRET\" ) ]]; then echo \"both app-id and app-secret required\" >&2; exit 1; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass credentials as a pair in scripts","Check interpolated variables are non-empty before running","Use --app id:secret to keep the pair atomic"],"tags":["cli","feishu","credentials"],"backgroundTag":"missing-required-argument","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}