{"record":{"id":"52e52e42dedc8675","repo":"Hmbown/CodeWhale","slug":"e","errorCode":null,"errorMessage":"{e}","messagePattern":"\\{e\\}","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/app-server/src/lib.rs","lineNumber":2513,"sourceCode":"            events: Vec::new(),\n        },\n        AppRequest::ConfigGet { key } => {\n            let cfg = state.config.read().await;\n            let value = cfg.get_display_value(&key);\n            AppResponse {\n                ok: true,\n                data: json!({ \"key\": key, \"value\": value }),\n                events: Vec::new(),\n            }\n        }\n        AppRequest::ConfigSet { key, value } => {\n            let (result, snapshot) = {\n                let mut cfg = state.config.write().await;\n                let result = cfg.set_value(&key, &value);\n                (result, cfg.clone())\n            };\n            let ok = result.is_ok();\n            let message = result.err().map(|e| e.to_string());\n            // Only propagate a mutation that actually happened. `set_value`\n            // leaves the config untouched on an unknown key or invalid value,\n            // so this is a no-op from the caller's point of view — but\n            // `apply_config_update` invalidates the cached stdio bridge\n            // regardless, and dropping the last reference kills the running\n            // child runtime along with its thread map. A single typo'd key\n            // would orphan every in-flight thread on that bridge.\n            if ok {\n                apply_config_update(state, snapshot, None, true).await;\n            }\n            AppResponse {\n                ok,\n                data: json!({ \"key\": key, \"value\": value, \"error\": message }),\n                events: Vec::new(),\n            }\n        }\n        AppRequest::ConfigUnset { key } => {\n            let (result, snapshot) = {","sourceCodeStart":2495,"sourceCodeEnd":2531,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/app-server/src/lib.rs#L2495-L2531","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the returned `message` — it names the invalid key or value; correct the key spelling or value type and resend.","Fetch the current schema/keys from the server (config get / setlist surface) instead of hardcoding key names in the client.","Validate the value type in the client before sending (string vs number vs bool) to match the target key's declared type.","Update the client to the matching server version if the key was renamed or removed."],"exampleFix":"// before: type mismatch\n{\"method\":\"config/set\",\"params\":{\"key\":\"model.temperature\",\"value\":\"0.7\"}}\n// after: numeric value for a numeric key\n{\"method\":\"config/set\",\"params\":{\"key\":\"model.temperature\",\"value\":0.7}}","handlingStrategy":"validation","validationCode":"// client-side, before sending config/set\nconst KNOWN_KEYS: &[(&str, &str)] = &[(\"model.temperature\", \"number\"), (\"model.name\", \"string\")];\nfn validate_set(key: &str, value: &serde_json::Value) -> Result<(), String> {\n    match KNOWN_KEYS.iter().find(|(k, _)| *k == key) {\n        None => Err(format!(\"unknown config key: {key}\")),\n        Some((_, ty)) if type_matches(value, ty) => Ok(()),\n        Some((_, ty)) => Err(format!(\"key {key} expects {ty}\")),\n    }\n}","typeGuard":"fn type_matches(v: &serde_json::Value, ty: &str) -> bool {\n    matches!((ty, v), (\"number\", Value::Number(_)) | (\"string\", Value::String(_)) | (\"bool\", Value::Bool(_)))\n}","tryCatchPattern":"if let Err(err) = response.error {\n    // err.message names the invalid key/value; fix and resend\n    log::warn!(\"config/set rejected: {}\", err.message);\n}","preventionTips":["Generate client config keys from the server schema instead of hardcoding.","Send JSON types matching each key's declared type.","Version-check the server before calling config mutation methods."],"tags":["json-rpc","config","validation","app-server"],"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"}