{"record":{"id":"28385b507f3ea9d6","repo":"BigPizzaV3/CodexPlusPlus","slug":"user-script-runtime-status-must-be-a-json-object","errorCode":null,"errorMessage":"user-script runtime status must be a JSON object","messagePattern":"user-script runtime status must be a JSON object","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/user_scripts.rs","lineNumber":42,"sourceCode":"        \"(() => JSON.stringify(window.__codexPlusUserScripts?.scripts || {}))()\",\n    )\n    .await?;\n    parse_live_runtime_status_response(&response)\n}\n\nfn live_runtime_target(targets: &[crate::cdp::CdpTarget]) -> anyhow::Result<crate::cdp::CdpTarget> {\n    crate::cdp::pick_injectable_codex_page_target(targets)\n}\n\nfn parse_live_runtime_status_response(response: &Value) -> anyhow::Result<Value> {\n    let encoded = response\n        .pointer(\"/result/result/value\")\n        .and_then(Value::as_str)\n        .context(\"user-script runtime probe returned no value\")?;\n    let status: Value =\n        serde_json::from_str(encoded).context(\"invalid user-script runtime status JSON\")?;\n    if !status.is_object() {\n        anyhow::bail!(\"user-script runtime status must be a JSON object\");\n    }\n    Ok(status)\n}\n\n#[derive(Debug, Clone, PartialEq, Eq, Serialize)]\npub struct UserScriptConfig {\n    pub enabled: bool,\n    pub scripts: BTreeMap<String, bool>,\n    #[serde(default, skip_serializing_if = \"BTreeMap::is_empty\")]\n    pub market: BTreeMap<String, MarketScriptInstall>,\n}\n\nimpl Default for UserScriptConfig {\n    fn default() -> Self {\n        Self {\n            enabled: true,\n            scripts: BTreeMap::new(),\n            market: BTreeMap::new(),","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/user_scripts.rs#L24-L60","documentation":"解析 CDP evaluate 返回的 user-script 运行时状态时，从 /result/result/value 取出的字符串经 serde_json 反序列化后不是 JSON object（可能是 null、数组或字符串），于是 parse_live_runtime_status_response 的类型校验失败。注意页面脚本本身用 || {} 兜底，因此真正到达此处的通常是序列化/反序列化产生的非对象值。","triggerScenarios":"Thrown at crates/codex-plus-core/src/user_scripts.rs:42 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["检查注入页面里 window.__codexPlusUserScripts 的实际结构，确认 scripts 字段未被覆盖为非对象","确认 CDP evaluate 返回链路（result/result/value 路径）没有截断或转义破坏 JSON","在浏览器控制台手动执行探测脚本核对返回值","若页面尚未注入 user-script runtime，先等待注入完成再探测"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}