Hmbown/CodeWhale · error

config ui schema

Error message

config ui schema

What it means

build_schema() converts the schema_for!(ConfigUiDocument) output to a serde_json::Value and unwraps. A schemars-generated schema of a plain struct is expected to serialize cleanly; failure indicates an incompatible schemars/serde_json combination or an exotic type in the document — a build/configuration bug.

Source

Thrown at crates/tui/src/config_ui.rs:495

            workspace_follow_symlinks: settings.workspace_follow_symlinks,
            provider_models: settings
                .provider_models
                .clone()
                .unwrap_or_default()
                .into_iter()
                .collect(),
            default_model,
        },
        config: ConfigSection {
            mcp_config_path: app.mcp_config_path.display().to_string(),
            reasoning_effort,
            status_items,
        },
    })
}

pub fn build_schema() -> Value {
    let mut schema = serde_json::to_value(schema_for!(ConfigUiDocument)).expect("config ui schema");
    schema["title"] = Value::String("Codewhale Config".to_string());
    schema["description"] = Value::String(
        "Tune live runtime choices and durable TUI defaults. Provider switching stays in /provider."
            .to_string(),
    );
    // Provider switching is asynchronous and owns client preflight, so this
    // editor shows the route identity only as validation context. `/provider`
    // remains the sole provider-switch surface.
    schema["$defs"]["RuntimeSection"]["properties"]["provider"]["readOnly"] = Value::Bool(true);
    schema
}

#[cfg(feature = "tui")]
pub fn run_tui_editor(app: &App, config: &Config) -> Result<ConfigUiDocument> {
    let document = build_document(app, config)?;
    let value = SchemaUI::new(serde_json::to_value(document.clone())?)
        .with_schema(build_schema())
        .with_title("Codewhale Config")

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Check schemars/serde_json version compatibility in Cargo.lock
  2. Remove non-representable types from ConfigUiDocument or adjust its schema attributes
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/tui/src/config_ui.rs:495 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/fe028e417664461b. Report an issue: GitHub.