chenhg5/cc-connect · error

multiple projects found, please specify --project (%s)

Error message

multiple projects found, please specify --project (%s)

What it means

A sentinel from resolveTargetProject: no --project flag was given, and the config contains more than one project, so the target is ambiguous. The message lists the sorted project names to choose from; the caller (e.g. feishu setup) aborts.

Source

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

}

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
}

func validateAppCredentials(appID, appSecret, platformType string) (string, error) {
	appID = strings.TrimSpace(appID)
	appSecret = strings.TrimSpace(appSecret)
	if appID == "" || appSecret == "" {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Re-run with --project <name>, choosing one of the names listed in the error message.
  2. If only one project is actually relevant, remove the other [[projects]] entries from config.toml.
  3. Verify exact project name spelling; the list in the error is authoritative (sorted, joined with ", ").

Example fix

// before
cc-connect feishu setup --app cli_x:sec
// after
cc-connect feishu setup --app cli_x:sec --project myproj
Defensive patterns

Strategy: validation

Validate before calling

projects, _ := config.ListProjects(); if len(projects) > 1 && project == "" { return fmt.Errorf("--project required; candidates: %s", strings.Join(projects, ", ")) }

Prevention

When it happens

Trigger: Running feishu/weixin/yuanbao setup with two or more [[projects]] entries in config.toml and no --project flag.

Common situations: Multi-repo users who configured several projects and then run setup for a new platform without naming the target project.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


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