Hmbown/CodeWhale · error

Config reload rejected because active thread routes are…

Error message

Config reload rejected because active thread routes are invalid: {}

What it means

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.

Solutions

  1. Read the failures list in the message to see which thread_id and validation error fired
  2. Fix the referenced route in the new config (restore the model/provider or correct the route)
  3. Close or finish the affected active threads before reloading
  4. Retry the reload after the config is valid

Example fix

// before (config removed the model an active thread routes to)
model = "gpt-old"
// after (keep route target valid)
model = "current-model"
Defensive patterns

Strategy: try-catch

Validate before calling

// validate routes for active threads against the new config before triggering reload
for (thread_id, route) in active_routes {
    validate_route(&new_config, &route).map_err(|e| format!("{thread_id}: {e}"))?;
}

Try / catch

match reload_config(&new_config) {
    Err(e) if e.to_string().starts_with("Config reload rejected") => {
        eprintln!("Fix active thread routes: {e}");
    }
    other => other?,
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/c0b7454d0449b71a. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/runtime_threads.rs:4947

                    )
                })
                .collect()
        };

        let mut validated = Vec::with_capacity(entries.len());
        let mut failures = Vec::new();
        for (thread_id, engine, provider_identity, engine_model, active_turn_id) in entries {
            match resolve_runtime_thread_route_for_identity(
                &new_config,
                &provider_identity,
                Some(&engine_model),
            ) {
                Ok(route) => validated.push((thread_id, engine, route, active_turn_id)),
                Err(err) => failures.push(format!("{thread_id}: {err}")),
            }
        }
        if !failures.is_empty() {
            bail!(
                "Config reload rejected because active thread routes are invalid: {}",
                failures.join("; ")
            );
        }

        // `engine_load` is still held here, so a thread cannot construct an
        // engine from the accepted config before its process-wide read/tool
        // byte limits are active. Rejected reloads leave the prior limits in
        // place.
        let workshop_activation = crate::tools::large_output_router::WorkshopConfig::install_active(
            new_config.workshop.as_ref(),
        );
        crate::initialize_cloud_facts(&new_config);
        crate::provider_catalog_live::maybe_load_persisted_cache_for_config(&new_config);
        let workflow_table = new_config.workflow_config();
        {
            let mut guard = self.config.write();
            *guard = new_config;

View on GitHub (pinned to 73e0f67d83)