Hmbown/CodeWhale · warning

{e}

Error message

{e}

What it means

JSON-RPC error message produced by the app-server's ConfigSet handler (crates/app-server/src/lib.rs:2513): when `config.set_value(&key, &value)` fails, the validation error string becomes the `message` field of the `JsonRpcError` response. A failed set changes nothing — the config is left untouched and no runtime bridge update is propagated.

Solutions

  1. Read the returned `message` — it names the invalid key or value; correct the key spelling or value type and resend.
  2. Fetch the current schema/keys from the server (config get / setlist surface) instead of hardcoding key names in the client.
  3. Validate the value type in the client before sending (string vs number vs bool) to match the target key's declared type.
  4. Update the client to the matching server version if the key was renamed or removed.

Example fix

// before: type mismatch
{"method":"config/set","params":{"key":"model.temperature","value":"0.7"}}
// after: numeric value for a numeric key
{"method":"config/set","params":{"key":"model.temperature","value":0.7}}
Defensive patterns

Strategy: validation

Validate before calling

// client-side, before sending config/set
const KNOWN_KEYS: &[(&str, &str)] = &[("model.temperature", "number"), ("model.name", "string")];
fn validate_set(key: &str, value: &serde_json::Value) -> Result<(), String> {
    match KNOWN_KEYS.iter().find(|(k, _)| *k == key) {
        None => Err(format!("unknown config key: {key}")),
        Some((_, ty)) if type_matches(value, ty) => Ok(()),
        Some((_, ty)) => Err(format!("key {key} expects {ty}")),
    }
}

Type guard

fn type_matches(v: &serde_json::Value, ty: &str) -> bool {
    matches!((ty, v), ("number", Value::Number(_)) | ("string", Value::String(_)) | ("bool", Value::Bool(_)))
}

Try / catch

if let Err(err) = response.error {
    // err.message names the invalid key/value; fix and resend
    log::warn!("config/set rejected: {}", err.message);
}

Prevention

When it happens

Trigger: Calling the `config/set` JSON-RPC method with an unknown config key, or a value that fails that key's type/range validation in `set_value`; e.g. sending a string where a bool is expected, an out-of-range number, or a typo'd key name.

Common situations: Clients (IDE extensions, scripts driving the stdio bridge) drifting from the current config schema after key renames; hand-written JSON payloads with wrong value types; stale clients sending keys removed in a newer server.

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/52e52e42dedc8675. Report an issue: GitHub.

Appendix: source

Thrown at crates/app-server/src/lib.rs:2513

            events: Vec::new(),
        },
        AppRequest::ConfigGet { key } => {
            let cfg = state.config.read().await;
            let value = cfg.get_display_value(&key);
            AppResponse {
                ok: true,
                data: json!({ "key": key, "value": value }),
                events: Vec::new(),
            }
        }
        AppRequest::ConfigSet { key, value } => {
            let (result, snapshot) = {
                let mut cfg = state.config.write().await;
                let result = cfg.set_value(&key, &value);
                (result, cfg.clone())
            };
            let ok = result.is_ok();
            let message = result.err().map(|e| e.to_string());
            // Only propagate a mutation that actually happened. `set_value`
            // leaves the config untouched on an unknown key or invalid value,
            // so this is a no-op from the caller's point of view — but
            // `apply_config_update` invalidates the cached stdio bridge
            // regardless, and dropping the last reference kills the running
            // child runtime along with its thread map. A single typo'd key
            // would orphan every in-flight thread on that bridge.
            if ok {
                apply_config_update(state, snapshot, None, true).await;
            }
            AppResponse {
                ok,
                data: json!({ "key": key, "value": value, "error": message }),
                events: Vec::new(),
            }
        }
        AppRequest::ConfigUnset { key } => {
            let (result, snapshot) = {

View on GitHub (pinned to 73e0f67d83)