Hmbown/CodeWhale · error

Runtime presets cannot override

Error message

Runtime presets cannot override {source}; change that controlling source first

What it means

Applying a runtime preset (via the apply path in the TUI) is blocked because a higher-priority controlling source — such as a managed policy file or CLI flag — already governs the same setting. The error names that source so the user changes the real controller first; runtime presets are strictly lower precedence.

Solutions

  1. Read the `{source}` named in the message and edit/remove that controlling configuration first
  2. Remove the CLI flag or managed-policy entry that pins the setting, then re-apply the preset
  3. Apply the equivalent setting directly in the controlling source instead of via a runtime preset

Example fix

// before: setting preset while managed-config pins it
apply_preset(SetupRuntimePreset::HighTrustLocal)
// after: remove managed override first, then
apply_preset(SetupRuntimePreset::HighTrustLocal)
Defensive patterns

Strategy: validation

Validate before calling

if let Some(source) = config.runtime_preset_blocker(
    config_path.as_deref(), profile.as_deref(), &workspace)
{
    eprintln!("preset blocked by {source}; change it first");
    return;
}
apply_preset(preset)?;

Try / catch

match apply_preset(preset) {
    Err(e) if e.to_string().starts_with("Runtime presets cannot override") => {
        // surface the controlling source to the user instead of retrying
        show_controlling_source_hint(&e);
    }
    r => r,
}

Prevention

When it happens

Trigger: Calling the apply-preset function when `config.runtime_preset_blocker(...)` returns a source (e.g. managed config file, CLI override, enterprise policy) for the given config path/profile/workspace.

Common situations: Enterprise-managed configuration deployed via policy file; user launched with a CLI flag that pins the setting; profile-specific config overriding runtime presets.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/tui/ui/apply.rs:2849

            engine_handle.cancel();
            mark_active_turn_cancelled_locally(app);
            app.status_message = Some(parent_stop_status(app, "Request cancelled"));
        }
    }
}

pub(crate) fn apply_setup_runtime_preset(
    app: &mut App,
    config: &mut Config,
    preset: crate::tui::setup::SetupRuntimePreset,
    state: codewhale_config::SetupState,
) -> Result<String> {
    if let Some(source) = config.runtime_preset_blocker(
        app.config_path.as_deref(),
        app.config_profile.as_deref(),
        &app.workspace,
    ) {
        anyhow::bail!(
            "Runtime presets cannot override {source}; change that controlling source first"
        );
    }
    if preset == crate::tui::setup::SetupRuntimePreset::HighTrustLocal {
        let approval = config.approval_policy_control(
            app.config_path.as_deref(),
            app.config_profile.as_deref(),
            &app.workspace,
        );
        if !approval.editable_root() {
            anyhow::bail!(
                "Full Access cannot override {}; change that controlling source first",
                approval.label()
            );
        }
    }

    let settings_path = Settings::path().context("failed to resolve settings path")?;

View on GitHub (pinned to 73e0f67d83)