chenhg5/cc-connect · error

multiple projects contain a tuitui platform; specify --proje

Error message

multiple projects contain a tuitui platform; specify --project

What it means

findTuiTuiOptions scans all projects in the config for a tuitui platform. If more than one project matches and no --project was given, the choice is ambiguous, so it refuses to guess and asks the user to disambiguate. Matches==0 returns an empty map instead (no error), which is why only the multi-match case errors.

Source

Thrown at cmd/cc-connect/tuitui.go:432

func findTuiTuiOptions(cfg *config.Config, opts tuituiCLIOptions) (map[string]any, bool, error) {
	var matches []config.PlatformConfig
	for _, proj := range cfg.Projects {
		if opts.project != "" && proj.Name != opts.project {
			continue
		}
		for _, pc := range proj.Platforms {
			if pc.Type != "tuitui" {
				continue
			}
			matches = append(matches, pc)
		}
	}
	if len(matches) == 0 {
		return map[string]any{}, false, nil
	}
	if opts.project == "" && len(matches) > 1 {
		return nil, false, fmt.Errorf("multiple projects contain a tuitui platform; specify --project")
	}
	out := make(map[string]any, len(matches[0].Options))
	for k, v := range matches[0].Options {
		out[k] = v
	}
	return out, true, nil
}

func filterTuiTuiHistory(result *tuitui.HistoryResult, query string) *tuitui.HistoryResult {
	query = strings.ToLower(strings.TrimSpace(query))
	if query == "" {
		return result
	}
	filtered := *result
	filtered.Messages = nil
	for _, msg := range result.Messages {
		data, _ := json.Marshal(msg)
		if strings.Contains(strings.ToLower(string(data)), query) {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Add --project <name> to select one of the matching projects
  2. Remove/duplicate-check the tuitui platform section if one project's copy is stale
  3. Keep a single tuitui platform if you intend a global default

Example fix

// before
cc-connect tuitui post --channel-id 123 --message hi
// after
cc-connect tuitui post --project team-a --channel-id 123 --message hi
Defensive patterns

Strategy: validation

Validate before calling

matches := countProjectsWithPlatform(cfg, "tuitui")
if matches > 1 && project == "" {
	return fmt.Errorf("%d projects have tuitui; pass --project", matches)
}

Try / catch

cli, err := loadTuiTuiPlatform(opts)
if err != nil && strings.Contains(err.Error(), "multiple projects") {
	return fmt.Errorf("%w (available: %v)", err, listTuituiProjects(cfg))
}

Prevention

When it happens

Trigger: Config contains >=2 projects each with a tuitui platform section, and runTuiTuiMessages/runTuiTuiPost is invoked without --project.

Common situations: Growing config where a second project recently gained a tuitui platform, breaking previously-working commands; shared team config with multiple tuitui workspaces.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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