{"record":{"id":"56b4c53848927880","repo":"Hmbown/CodeWhale","slug":"failed-to-resolve-runtime-thread-route-reason","errorCode":null,"errorMessage":"Failed to resolve runtime thread route: {reason}","messagePattern":"Failed to resolve runtime thread route: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":4314,"sourceCode":"        bucket\n            .unpriced_reasons\n            .insert(\"provider_success_missing_usage\".to_string());\n        bucket\n            .cny_unpriced_reasons\n            .insert(\"provider_success_missing_usage\".to_string());\n    }\n    bucket\n        .route_receipts\n        .insert(format!(\"{} usage=missing\", route.receipt(&audit)));\n}\n\nfn resolve_runtime_thread_route(\n    config: &Config,\n    provider: ApiProvider,\n    model_selector: Option<&str>,\n) -> Result<ResolvedRuntimeRoute> {\n    resolve_runtime_route(config, provider, model_selector)\n        .map_err(|reason| anyhow!(\"Failed to resolve runtime thread route: {reason}\"))\n}\n\nfn resolve_runtime_thread_route_for_identity(\n    config: &Config,\n    identity: &ProviderIdentity,\n    model_selector: Option<&str>,\n) -> Result<ResolvedRuntimeRoute> {\n    resolve_runtime_route_for_identity(config, identity, model_selector)\n        .map_err(|reason| anyhow!(\"Failed to resolve runtime thread route: {reason}\"))\n}\n\nfn runtime_compaction_config(\n    config: &Config,\n    provider: ApiProvider,\n    model: &str,\n    route_limits: Option<codewhale_config::route::RouteLimits>,\n    auto_compact: bool,\n    auto_compact_explicit: bool,","sourceCodeStart":4296,"sourceCodeEnd":4332,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/runtime_threads.rs#L4296-L4332","documentation":"resolve_runtime_thread_route wraps resolve_runtime_route and converts its failure into 'Failed to resolve runtime thread route: {reason}'. It is thrown when the configured provider/model combination cannot be resolved to a concrete route (provider identity, base URL, model) for a runtime thread. The inner reason carries the specifics.","triggerScenarios":"Starting or preflighting a runtime thread when config's provider/model settings cannot be resolved: unknown provider enum value, missing provider identity, unresolvable model_selector string, or missing route configuration for the given ApiProvider.","commonSituations":"Typo'd model selector string passed to thread creation; config referencing a provider removed or renamed in this version; missing base-url/api-key config for a custom provider; config reload left stale provider settings.","solutions":["Read the {reason} suffix — it names the unresolvable piece (provider, identity, or model selector).","Check the Config's provider settings for the given ApiProvider: identity, base URL, and credentials are present.","Verify the model_selector string matches a model registered for that provider exactly.","If triggered after a config edit or upgrade, reconcile the config with the current provider registry and retry."],"exampleFix":"// before: unknown selector\nlet route = resolve_runtime_thread_route(&cfg, ApiProvider::Anthropic, Some(\"claude-9-fake\"))?;\n// after: use a registered model\nlet route = resolve_runtime_thread_route(&cfg, ApiProvider::Anthropic, Some(\"claude-sonnet-4\"))?;","handlingStrategy":"validation","validationCode":"// preflight the route before spawning the thread\nlet selector = Some(\"claude-sonnet-4\");\nlet known = cfg.models_for(cfg.api_provider()).iter().any(|m| Some(&m.name) == selector);\nanyhow::ensure!(known || selector.is_none(), \"unknown model selector\");\n","typeGuard":null,"tryCatchPattern":"let route = match resolve_runtime_thread_route(&cfg, provider, selector) {\n    Ok(r) => r,\n    Err(e) => { log::error!(\"route resolution failed: {e:#}\"); return Err(e); }\n};\n","preventionTips":["Validate model selector strings against the registry at config load time.","Keep provider identity/base-url/credentials complete for every ApiProvider in use.","Re-run route preflight after any config edit or upgrade.","Avoid free-text model names; use constants from the model registry."],"tags":["configuration","routing","provider","model"],"backgroundTag":"invalid-config-value","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"}