chenhg5/cc-connect · error

no project found in config

Error message

no project found in config

What it means

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.

Source

Thrown at cmd/cc-connect/feishu.go:444

	appSecret = strings.TrimSpace(raw[idx+1:])
	if appID == "" || appSecret == "" {
		return "", "", fmt.Errorf("--app format must be app_id:app_secret")
	}
	return appID, appSecret, nil
}

func resolveTargetProject(project string) (string, error) {
	project = strings.TrimSpace(project)
	if project != "" {
		return project, nil
	}
	projects, err := config.ListProjects()
	if err != nil {
		return "", err
	}
	switch len(projects) {
	case 0:
		return "", fmt.Errorf("no project found in config")
	case 1:
		return projects[0], nil
	default:
		sort.Strings(projects)
		return "", fmt.Errorf("multiple projects found, please specify --project (%s)", strings.Join(projects, ", "))
	}
}

func normalizeFeishuPlatformType(raw string) (string, error) {
	raw = strings.ToLower(strings.TrimSpace(raw))
	if raw == "" {
		return "", nil
	}
	if raw != "feishu" && raw != "lark" {
		return "", fmt.Errorf("invalid --platform-type %q, want feishu or lark", raw)
	}
	return raw, nil
}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Initialize a project in config first (or create config.toml with at least one [[project]] entry), then re-run setup.
  2. Pass --project explicitly only after the project exists; it does not create one.
  3. Check that CC_CONNECT_CONFIG / the expected config path points at the file you actually populated.

Example fix

// before (empty config, running setup directly)
cc-connect feishu setup --app cli_x:sec
// after
cat >> config.toml <<'EOF'
[[projects]]
name = "myproj"
path = "/path/to/repo"
EOF
cc-connect feishu setup --app cli_x:sec
Defensive patterns

Strategy: validation

Validate before calling

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") }

Prevention

When it happens

Trigger: Running feishu/weixin/yuanbao setup without --project while the config file contains no project entries at all (fresh install, or config was emptied/deleted).

Common situations: Running setup before ever initializing cc-connect; pointing the tool at an empty or missing config.toml; wiping projects while reorganizing config.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/0fe66afcfce86532. Report an issue: GitHub.