{"record":{"id":"d3900493abf65302","repo":"Hmbown/CodeWhale","slug":"profile-profile-name-not-found-available-prof","errorCode":null,"errorMessage":"Profile '{profile_name}' not found. Available profiles: {available}","messagePattern":"Profile '(.+?)' not found\\. Available profiles: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/config.rs","lineNumber":11156,"sourceCode":"        match profiles.and_then(|profiles| profiles.get(profile_name)) {\n            Some(override_cfg) => {\n                let mut merged = merge_config(*config.base, override_cfg.clone());\n                apply_layer_root_model(&mut merged, override_cfg);\n                Ok(merged)\n            }\n            None => {\n                let available = profiles\n                    .map(|profiles| {\n                        let mut keys = profiles.keys().cloned().collect::<Vec<_>>();\n                        keys.sort();\n                        if keys.is_empty() {\n                            \"none\".to_string()\n                        } else {\n                            keys.join(\", \")\n                        }\n                    })\n                    .unwrap_or_else(|| \"none\".to_string());\n                anyhow::bail!(\"Profile '{profile_name}' not found. Available profiles: {available}\")\n            }\n        }\n    } else {\n        Ok(*config.base)\n    }\n}\n\nfn merge_config(base: Config, override_cfg: Config) -> Config {\n    // Captured before the struct literal moves the field out of `override_cfg`.\n    let override_defines_root_base_url = override_cfg.base_url.is_some();\n    Config {\n        custom_models: override_cfg.custom_models.or(base.custom_models),\n        provider: override_cfg.provider.or(base.provider),\n        telemetry: override_cfg.telemetry.or(base.telemetry),\n        api_key: override_cfg.api_key.or(base.api_key),\n        base_url: override_cfg.base_url.or(base.base_url),\n        http_headers: override_cfg.http_headers.or(base.http_headers),\n        default_text_model: override_cfg","sourceCodeStart":11138,"sourceCodeEnd":11174,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/config.rs#L11138-L11174","documentation":"Profile resolution looks up profile_name in the configured profiles map; if the containing table exists but the key does not, it bails listing all available profile keys so the user can pick a valid one. Configs without a profiles table fall through to the base profile instead of erroring.","triggerScenarios":"Requesting --profile <name> (or profile resolution via config) where the profiles table exists but does not contain that key; the error lists the valid keys, or 'none' when the table is empty.","commonSituations":"Typo in the profile name; renaming a profile in config.toml while scripts/CI still pass the old name; running on a machine whose config lacks the profile defined elsewhere.","solutions":["Use one of the profile names listed in the error message","Fix the spelling in your --profile flag or script","Add the missing [profiles.<name>] table to ~/.codewhale/config.toml","Omit --profile to use the base configuration"],"exampleFix":"// before (config.toml has only [profiles.work])\ncodewhale --profile prod\n// after\ncodewhale --profile work\n# or add:\n# [profiles.prod]\n# base = \"work\"","handlingStrategy":"validation","validationCode":"// check the profile exists in config.toml before passing --profile\nlet cfg = std::fs::read_to_string(\"~/.codewhale/config.toml\")?;\nif !cfg.contains(&format!(\"[profiles.{name}]\")) {\n    eprintln!(\"profile '{name}' not defined in config.toml\");\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"not found. Available profiles\") => eprintln!(\"pick one of the listed profiles or add [profiles.<name>] to config.toml\"),\n    other => other?,\n}","preventionTips":["List profiles from config.toml before scripting","Update scripts/CI when renaming profiles","Keep profiles defined in a shared config for team machines"],"tags":["config","profile","lookup","cli"],"backgroundTag":"entity-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}