{"record":{"id":"c0b7454d0449b71a","repo":"Hmbown/CodeWhale","slug":"config-reload-rejected-because-active-thread-route","errorCode":null,"errorMessage":"Config reload rejected because active thread routes are invalid: {}","messagePattern":"Config reload rejected because active thread routes are invalid: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":4947,"sourceCode":"                    )\n                })\n                .collect()\n        };\n\n        let mut validated = Vec::with_capacity(entries.len());\n        let mut failures = Vec::new();\n        for (thread_id, engine, provider_identity, engine_model, active_turn_id) in entries {\n            match resolve_runtime_thread_route_for_identity(\n                &new_config,\n                &provider_identity,\n                Some(&engine_model),\n            ) {\n                Ok(route) => validated.push((thread_id, engine, route, active_turn_id)),\n                Err(err) => failures.push(format!(\"{thread_id}: {err}\")),\n            }\n        }\n        if !failures.is_empty() {\n            bail!(\n                \"Config reload rejected because active thread routes are invalid: {}\",\n                failures.join(\"; \")\n            );\n        }\n\n        // `engine_load` is still held here, so a thread cannot construct an\n        // engine from the accepted config before its process-wide read/tool\n        // byte limits are active. Rejected reloads leave the prior limits in\n        // place.\n        let workshop_activation = crate::tools::large_output_router::WorkshopConfig::install_active(\n            new_config.workshop.as_ref(),\n        );\n        crate::initialize_cloud_facts(&new_config);\n        crate::provider_catalog_live::maybe_load_persisted_cache_for_config(&new_config);\n        let workflow_table = new_config.workflow_config();\n        {\n            let mut guard = self.config.write();\n            *guard = new_config;","sourceCodeStart":4929,"sourceCodeEnd":4965,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/runtime_threads.rs#L4929-L4965","documentation":"On config reload, the Runtime revalidates the routes of all active threads. If any thread's route fails validation, the whole reload is rejected (bail) with a joined list of 'thread_id: err' failures, because a partially-reloaded config would leave active threads inconsistent.","triggerScenarios":"Calling the config reload path (runtime_threads.rs) while one or more active threads have routes that fail validation against the new config (e.g. removed model/provider, malformed route).","commonSituations":"Editing config while turns are active; removing a model or provider that an open thread still routes to; typo'd route entry in the new config.","solutions":["Read the failures list in the message to see which thread_id and validation error fired","Fix the referenced route in the new config (restore the model/provider or correct the route)","Close or finish the affected active threads before reloading","Retry the reload after the config is valid"],"exampleFix":"// before (config removed the model an active thread routes to)\nmodel = \"gpt-old\"\n// after (keep route target valid)\nmodel = \"current-model\"","handlingStrategy":"try-catch","validationCode":"// validate routes for active threads against the new config before triggering reload\nfor (thread_id, route) in active_routes {\n    validate_route(&new_config, &route).map_err(|e| format!(\"{thread_id}: {e}\"))?;\n}","typeGuard":null,"tryCatchPattern":"match reload_config(&new_config) {\n    Err(e) if e.to_string().starts_with(\"Config reload rejected\") => {\n        eprintln!(\"Fix active thread routes: {e}\");\n    }\n    other => other?,\n}","preventionTips":["Don't remove models/providers that active threads still route to","Finish or close active threads before structural config changes","Run the new config through route validation in a staging dir first"],"tags":["config","reload","validation"],"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"}