{"record":{"id":"349e91aad2d3e717","repo":"Hmbown/CodeWhale","slug":"cannot-resolve-the-user-global-model-configuration","errorCode":null,"errorMessage":"Cannot resolve the user-global model configuration.","messagePattern":"Cannot resolve the user-global model configuration\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/app.rs","lineNumber":1452,"sourceCode":"fn persist_route_as_startup_default(\n    provider: ApiProvider,\n    provider_identity: &str,\n    model: &str,\n) -> String {\n    let route = format!(\"{provider_identity}/{model}\");\n    match try_persist_route_as_startup_default(provider, provider_identity, model) {\n        Ok(()) => format!(\"Remembered {route} as the startup default (config.toml).\"),\n        Err(err) => format!(\"Save failed: {err}\"),\n    }\n}\n\nfn try_persist_route_as_startup_default(\n    provider: ApiProvider,\n    provider_identity: &str,\n    model: &str,\n) -> anyhow::Result<()> {\n    let path = crate::config::home_config_path()\n        .ok_or_else(|| anyhow::anyhow!(\"Cannot resolve the user-global model configuration.\"))?;\n    crate::config_persistence::persist_provider_selection(\n        Some(&path),\n        provider,\n        provider_identity,\n        Some(model),\n    )\n    .map(|_| ())\n}\n\npub struct App {\n    pub mode: AppMode,\n    /// Registered hotbar actions available for future slot config/render layers.\n    pub hotbar_actions: HotbarActionRegistry,\n    /// Composer sub-state (input, cursor, history, menus).\n    pub composer: ComposerState,\n    /// Viewport sub-state (scroll, cache, selection).\n    pub viewport: ViewportState,\n    /// Ocean work-surface state. Kept separate from transcript/sidebar state","sourceCodeStart":1434,"sourceCodeEnd":1470,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tui/app.rs#L1434-L1470","documentation":"`try_persist_route_as_startup_default` persists the chosen provider/model as the user-global startup default by writing to the user's home config file. `crate::config::home_config_path()` returns Option and None means no home config directory could be resolved, so persistence aborts with this error.","triggerScenarios":"Selecting a provider/model in the TUI and triggering persist-as-startup-default while `home_config_path()` returns None — typically no resolvable HOME directory or a platform where the config dir cannot be determined.","commonSituations":"Running in a container/CI with HOME unset or set to a non-writable path; sandboxed environment without a home directory; unusual XDG_CONFIG_HOME setups.","solutions":["Set HOME to a writable directory before launching the app","Create/verify the user config directory exists and is writable","Skip persisting the startup default and set it per-session instead"],"exampleFix":"// before\nexport HOME=  # unset in container\n$ codewhale\n// after\nexport HOME=/home/user\n$ codewhale","handlingStrategy":"fallback","validationCode":"if (!process.env.HOME || !fs.existsSync(process.env.HOME)) {\n  console.warn('no home directory; skipping startup-default persistence');\n}","typeGuard":null,"tryCatchPattern":"match try_persist_route_as_startup_default(provider, id, model) {\n    Ok(_) => {}\n    Err(e) => log::warn!(\"persist startup default skipped: {e}\"),\n}","preventionTips":["Ensure HOME is set and writable in containers/CI","Create the user config directory before first launch","Treat startup-default persistence as best-effort, not mandatory"],"tags":["config","persistence","home-directory"],"backgroundTag":"missing-env-var","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"}