{"record":{"id":"0fe66afcfce86532","repo":"chenhg5/cc-connect","slug":"no-project-found-in-config","errorCode":null,"errorMessage":"no project found in config","messagePattern":"no project found in config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/feishu.go","lineNumber":444,"sourceCode":"\tappSecret = strings.TrimSpace(raw[idx+1:])\n\tif appID == \"\" || appSecret == \"\" {\n\t\treturn \"\", \"\", fmt.Errorf(\"--app format must be app_id:app_secret\")\n\t}\n\treturn appID, appSecret, nil\n}\n\nfunc resolveTargetProject(project string) (string, error) {\n\tproject = strings.TrimSpace(project)\n\tif project != \"\" {\n\t\treturn project, nil\n\t}\n\tprojects, err := config.ListProjects()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tswitch len(projects) {\n\tcase 0:\n\t\treturn \"\", fmt.Errorf(\"no project found in config\")\n\tcase 1:\n\t\treturn projects[0], nil\n\tdefault:\n\t\tsort.Strings(projects)\n\t\treturn \"\", fmt.Errorf(\"multiple projects found, please specify --project (%s)\", strings.Join(projects, \", \"))\n\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}","sourceCodeStart":426,"sourceCodeEnd":462,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/feishu.go#L426-L462","documentation":"resolveTargetProject determines which project in the cc-connect config a setup command should target. When `config.ListProjects()` returns zero projects it throws \"no project found in config\", because setup has nothing to write the Feishu credentials into.","triggerScenarios":"Running feishu/weixin/yuanbao setup without --project while the config file contains no project entries at all (fresh install, or config was emptied/deleted).","commonSituations":"Running setup before ever initializing cc-connect; pointing the tool at an empty or missing config.toml; wiping projects while reorganizing config.","solutions":["Initialize a project in config first (or create config.toml with at least one [[project]] entry), then re-run setup.","Pass --project explicitly only after the project exists; it does not create one.","Check that CC_CONNECT_CONFIG / the expected config path points at the file you actually populated."],"exampleFix":"// before (empty config, running setup directly)\ncc-connect feishu setup --app cli_x:sec\n// after\ncat >> config.toml <<'EOF'\n[[projects]]\nname = \"myproj\"\npath = \"/path/to/repo\"\nEOF\ncc-connect feishu setup --app cli_x:sec","handlingStrategy":"validation","validationCode":"projects, err := config.ListProjects(); if err != nil { return err }; if len(projects) == 0 { return errors.New(\"create a project in config.toml before running setup\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Initialize at least one project in config.toml before running any setup subcommand.","Keep CC_CONNECT_CONFIG pointing at the populated config file.","Add setup to onboarding docs as step 2 after project creation."],"tags":["cli","config","setup"],"backgroundTag":"empty-result-set","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"}