{"record":{"id":"b42aae3597602e57","repo":"chenhg5/cc-connect","slug":"app-id-app-secret-are-required","errorCode":null,"errorMessage":"app_id/app_secret are required","messagePattern":"app_id/app_secret are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/feishu.go","lineNumber":468,"sourceCode":"\t}\n}\n\nfunc normalizeFeishuPlatformType(raw string) (string, error) {\n\traw = strings.ToLower(strings.TrimSpace(raw))\n\tif raw == \"\" {\n\t\treturn \"\", nil\n\t}\n\tif raw != \"feishu\" && raw != \"lark\" {\n\t\treturn \"\", fmt.Errorf(\"invalid --platform-type %q, want feishu or lark\", raw)\n\t}\n\treturn raw, nil\n}\n\nfunc validateAppCredentials(appID, appSecret, platformType string) (string, error) {\n\tappID = strings.TrimSpace(appID)\n\tappSecret = strings.TrimSpace(appSecret)\n\tif appID == \"\" || appSecret == \"\" {\n\t\treturn \"\", errors.New(\"app_id/app_secret are required\")\n\t}\n\n\tcandidates := []string{\"feishu\", \"lark\"}\n\tif platformType == \"feishu\" || platformType == \"lark\" {\n\t\tcandidates = []string{platformType}\n\t}\n\n\tvar lastErr error\n\tfor _, candidate := range candidates {\n\t\tbase := openFeishuBaseURL\n\t\tif candidate == \"lark\" {\n\t\t\tbase = openLarkBaseURL\n\t\t}\n\t\tok, err := validateAppCredentialsAgainstBase(base, appID, appSecret)\n\t\tif err != nil {\n\t\t\tlastErr = err\n\t\t\tcontinue\n\t\t}","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/feishu.go#L450-L486","documentation":"validateAppCredentials trims the supplied app_id and app_secret and fails fast if either is empty, returning this error before attempting any Feishu/Lark API validation. The setup wizard refuses to write an unusable platform config. It is a pure input check, not a network or auth failure.","triggerScenarios":"Running `cc-connect feishu setup` (runFeishuSetup) and answering the app_id or app_secret prompt with empty input, or passing an empty/whitespace-only value programmatically to validateAppCredentials.","commonSituations":"Developer skipped the credential prompt by pressing Enter, pasted only one of the two values, an env var like FEISHU_APP_SECRET was unset so the shell substituted an empty string, or copied a config template with placeholder credentials removed.","solutions":["Obtain app_id and app_secret from the Feishu/Lark Open Platform console for your app","Re-run `cc-connect feishu setup` and paste both values when prompted","If sourcing from env, verify the variables are set: `echo -n \"$FEISHU_APP_ID\" | wc -c`","Trim stray whitespace/newlines when pasting; the code trims but cannot invent values"],"exampleFix":"// before\nvalidateAppCredentials(\"\", \"\", \"feishu\") // error\n// after\nvalidateAppCredentials(\"cli_a1b2c3\", os.Getenv(\"FEISHU_APP_SECRET\"), \"feishu\")","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(appID) == \"\" || strings.TrimSpace(appSecret) == \"\" {\n    return errors.New(\"app_id/app_secret are required\")\n}","typeGuard":"func hasCredentials(appID, appSecret string) bool {\n    return strings.TrimSpace(appID) != \"\" && strings.TrimSpace(appSecret) != \"\"\n}","tryCatchPattern":null,"preventionTips":["Keep credentials in env vars or a secret store, never typed ad hoc during setup","Source and echo env vars before running setup to confirm they are non-empty","Trim pasted values of trailing newlines before submitting"],"tags":["feishu","setup","credentials","validation"],"backgroundTag":"missing-required-config-field","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"}