chenhg5/cc-connect · error

project %q not found

Error message

project %q not found

What it means

After successfully loading and parsing the config, GetProjectProviders scans cfg.Projects for one whose Name equals projectName; if none matches it returns (nil, "", fmt.Errorf("project %q not found", projectName)). Exact, case-sensitive string match on the project's configured name.

Source

Thrown at config/config.go:1851

func GetProjectProviders(projectName string) ([]ProviderConfig, string, error) {
	if ConfigPath == "" {
		return nil, "", fmt.Errorf("config path not set")
	}
	data, err := os.ReadFile(ConfigPath)
	if err != nil {
		return nil, "", fmt.Errorf("read config: %w", err)
	}
	cfg := &Config{}
	if err := toml.Unmarshal(data, cfg); err != nil {
		return nil, "", fmt.Errorf("parse config: %w", err)
	}
	for _, p := range cfg.Projects {
		if p.Name == projectName {
			active, _ := p.Agent.Options["provider"].(string)
			return p.Agent.Providers, active, nil
		}
	}
	return nil, "", fmt.Errorf("project %q not found", projectName)
}

// FeishuCredentialUpdateOptions controls how Feishu/Lark platform credentials
// are written back into config.toml for a specific project.
type FeishuCredentialUpdateOptions struct {
	ProjectName       string // required
	PlatformIndex     int    // 1-based index among feishu/lark platforms in the project; 0 = first
	PlatformType      string // optional target type: "feishu" or "lark"; empty keeps existing type
	AppID             string // required
	AppSecret         string // required
	OwnerOpenID       string // optional owner id from onboarding flow
	SetAllowFromEmpty bool   // when true, seed/append allow_from with OwnerOpenID while preserving "*"
}

// EnsureProjectWithFeishuOptions controls project auto-provisioning for Feishu/Lark setup.
type EnsureProjectWithFeishuOptions struct {
	ProjectName      string // required
	PlatformType     string // optional: "feishu" or "lark", default "feishu"

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Enumerate projects in config.toml (or via the app's project list command) and use the exact Name value.
  2. Check ConfigPath points to the config file that actually contains the project.
  3. Fix casing — the comparison is exact equality, not case-insensitive.
  4. Handle the error to prompt the user to create the project if it legitimately doesn't exist.

Example fix

// before
p, _, err := config.GetProjectProviders("Demo") // stored as "demo" -> not found
// after
projects, _ := config.ListProjects()
if !slices.ContainsFunc(projects, func(p config.ProjectConfig) bool { return p.Name == "demo" }) {
    return fmt.Errorf("project %q not configured", "demo")
}
p, _, err := config.GetProjectProviders("demo")
Defensive patterns

Strategy: validation

Validate before calling

projects, err := config.ListProjects()
if err != nil { return err }
if !slices.ContainsFunc(projects, func(p config.ProjectConfig) bool { return p.Name == projectName }) {
    return fmt.Errorf("project %q not configured", projectName)
}

Type guard

func projectExists(name string) bool {
    projects, err := config.ListProjects()
    if err != nil { return false }
    return slices.ContainsFunc(projects, func(p config.ProjectConfig) bool { return p.Name == name })
}

Try / catch

providers, active, err := config.GetProjectProviders(project)
if err != nil {
    if strings.Contains(err.Error(), "not found") {
        return fmt.Errorf("unknown project %q — run 'project list' to see valid names", project)
    }
    return err
}

Prevention

When it happens

Trigger: Calling config.GetProjectProviders("name") where no [[projects]] entry has that exact Name — wrong project name, project defined in a different config file, or casing mismatch.

Common situations: Typos or different naming between a UI and config.toml; querying a project that was removed or renamed; multi-config setups where ConfigPath points to a file lacking the project; automation passing an ID instead of the display name.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — 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/a1e59c13659d93db. Report an issue: GitHub.