chenhg5/cc-connect · error

project %q not found in config

Error message

project %q not found in config

What it means

After loading the config, reloadConfig looks for a project whose Name matches projName; if none matches, it returns this error and aborts the hot reload. It means the config file loaded fine but contains no [projects] entry with that exact name. The engine keeps running with its previous configuration.

Source

Thrown at cmd/cc-connect/main.go:1748

	}

	result := &core.ConfigReloadResult{}

	// Re-apply process-global hot-reloadable settings.
	if globalAPIServer != nil {
		globalAPIServer.SetMaxAttachmentSize(resolveMaxAttachmentSize(cfg))
	}

	// Find the matching project
	var proj *config.ProjectConfig
	for i := range cfg.Projects {
		if cfg.Projects[i].Name == projName {
			proj = &cfg.Projects[i]
			break
		}
	}
	if proj == nil {
		return nil, fmt.Errorf("project %q not found in config", projName)
	}

	// Reload display config (includes legacy quiet → display mapping)
	mode, tm, tool, tmlen, toollen, showCtx, showFooter, hideAgentFooter := config.EffectiveDisplay(cfg, proj)
	historyMaxLen := config.EffectiveHistoryMaxLen(cfg, proj)
	engine.SetDisplayConfig(core.DisplayCfg{
		Mode:             mode,
		CardMode:         config.EffectiveCardMode(cfg, proj),
		ThinkingMessages: tm,
		ThinkingMaxLen:   tmlen,
		ToolMaxLen:       toollen,
		ToolMessages:     tool,
		HistoryMaxLen:    &historyMaxLen,
		HideAgentFooter:  hideAgentFooter,
	})
	result.DisplayUpdated = true

	// Wire show_context_indicator and reply_footer from display config

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Check config.toml has a [projects] entry whose name exactly matches the requested projName.
  2. Fix casing/whitespace differences (comparison is exact ==).
  3. Re-add the missing project block if it was deleted unintentionally.
  4. Update the caller (web request) to use the new project name after a rename.

Example fix

// before (config lacks the project)
reloadConfig(path, "myproj", engine) // project "myproj" not found in config
// after — guard before reload
found := false
for _, p := range cfg.Projects {
    if p.Name == projName { found = true; break }
}
if !found {
    return nil, fmt.Errorf("project %q not found in config; available: %v", projName, names(cfg.Projects))
}
Defensive patterns

Strategy: validation

Validate before calling

func projectExists(cfg *config.Config, name string) bool {
    for _, p := range cfg.Projects {
        if p.Name == name { return true }
    }
    return false
}
// call: if !projectExists(cfg, projName) { abort reload }

Try / catch

if _, err := reloadConfig(path, projName, engine); err != nil {
    if strings.Contains(err.Error(), "not found in config") {
        return fmt.Errorf("reload skipped: %v (check [projects] name spelling)", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling reloadConfig with a projName that is absent from the freshly loaded cfg.Projects — e.g. the project was removed or renamed in config.toml, or the caller passed a name with different casing/whitespace.

Common situations: Renaming a project in config.toml while the web UI still references the old name; deleting a project block then hitting reload for it; mismatched quotes/spacing in the project name.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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