{"record":{"id":"53f830a8ee513775","repo":"chenhg5/cc-connect","slug":"project-q-not-found-in-config","errorCode":null,"errorMessage":"project %q not found in config","messagePattern":"project %q not found in config","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/main.go","lineNumber":1748,"sourceCode":"\t}\n\n\tresult := &core.ConfigReloadResult{}\n\n\t// Re-apply process-global hot-reloadable settings.\n\tif globalAPIServer != nil {\n\t\tglobalAPIServer.SetMaxAttachmentSize(resolveMaxAttachmentSize(cfg))\n\t}\n\n\t// Find the matching project\n\tvar proj *config.ProjectConfig\n\tfor i := range cfg.Projects {\n\t\tif cfg.Projects[i].Name == projName {\n\t\t\tproj = &cfg.Projects[i]\n\t\t\tbreak\n\t\t}\n\t}\n\tif proj == nil {\n\t\treturn nil, fmt.Errorf(\"project %q not found in config\", projName)\n\t}\n\n\t// Reload display config (includes legacy quiet → display mapping)\n\tmode, tm, tool, tmlen, toollen, showCtx, showFooter, hideAgentFooter := config.EffectiveDisplay(cfg, proj)\n\thistoryMaxLen := config.EffectiveHistoryMaxLen(cfg, proj)\n\tengine.SetDisplayConfig(core.DisplayCfg{\n\t\tMode:             mode,\n\t\tCardMode:         config.EffectiveCardMode(cfg, proj),\n\t\tThinkingMessages: tm,\n\t\tThinkingMaxLen:   tmlen,\n\t\tToolMaxLen:       toollen,\n\t\tToolMessages:     tool,\n\t\tHistoryMaxLen:    &historyMaxLen,\n\t\tHideAgentFooter:  hideAgentFooter,\n\t})\n\tresult.DisplayUpdated = true\n\n\t// Wire show_context_indicator and reply_footer from display config","sourceCodeStart":1730,"sourceCodeEnd":1766,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/main.go#L1730-L1766","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check config.toml has a [projects] entry whose name exactly matches the requested projName.","Fix casing/whitespace differences (comparison is exact ==).","Re-add the missing project block if it was deleted unintentionally.","Update the caller (web request) to use the new project name after a rename."],"exampleFix":"// before (config lacks the project)\nreloadConfig(path, \"myproj\", engine) // project \"myproj\" not found in config\n// after — guard before reload\nfound := false\nfor _, p := range cfg.Projects {\n    if p.Name == projName { found = true; break }\n}\nif !found {\n    return nil, fmt.Errorf(\"project %q not found in config; available: %v\", projName, names(cfg.Projects))\n}","handlingStrategy":"validation","validationCode":"func projectExists(cfg *config.Config, name string) bool {\n    for _, p := range cfg.Projects {\n        if p.Name == name { return true }\n    }\n    return false\n}\n// call: if !projectExists(cfg, projName) { abort reload }","typeGuard":null,"tryCatchPattern":"if _, err := reloadConfig(path, projName, engine); err != nil {\n    if strings.Contains(err.Error(), \"not found in config\") {\n        return fmt.Errorf(\"reload skipped: %v (check [projects] name spelling)\", err)\n    }\n    return err\n}","preventionTips":["Copy project names exactly (including case) from config.toml into API calls.","After renaming/removing a project in config.toml, update all clients referencing it.","List projects via the web UI/CLI before reloading to confirm the name exists.","Avoid trailing spaces in project names inside TOML."],"tags":["go","config","projects","hot-reload"],"backgroundTag":"entity-not-found","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}