BigPizzaV3/CodexPlusPlus · error
user-script runtime status must be a JSON object
Error message
user-script runtime status must be a JSON object
What it means
parse_live_runtime_status_response decodes the doubly-encoded JSON returned by the user-script runtime probe (at pointer /result/result/value) and expects the decoded status to be a JSON object. If the decoded value is any other JSON type (string, array, number, null), the runtime status cannot be mapped onto the expected status shape and the function bails.
Solutions
- Ensure the user-script runtime status probe returns a JSON object (e.g. `{"running":true,"scripts":[...]}`), not a scalar or array.
- Check which script binary/entrypoint is registered as the runtime probe and update it to the current version.
- Log the decoded `status` value before this call to see what shape is actually returned, then fix the producer side.
Example fix
// before (runtime script output)
echo "running";
// after
echo '{"running": true, "scripts": []}'; Defensive patterns
Strategy: type-guard
Validate before calling
let raw: serde_json::Value = serde_json::from_str(encoded)?;
if !raw.is_object() {
eprintln!("runtime probe returned non-object status: {raw}");
return Ok(default_status());
} Type guard
fn status_object(v: &serde_json::Value) -> Option<&serde_json::Map<String, serde_json::Value>> {
v.as_object()
} Try / catch
match parse_live_runtime_status_response(&encoded) {
Ok(status) => render(status),
Err(e) if e.to_string().contains("must be a JSON object") => render_runtime_unavailable(),
Err(e) => return Err(e),
} Prevention
- Keep the runtime status probe script in lockstep with the expected JSON schema.
- Return structured JSON objects from the runtime even on failure (e.g. {"running": false, "error": "..."}).
- Version the status schema and validate it in runtime script tests.
When it happens
Trigger: live_runtime_status receiving a probe result whose inner `value` parses to a non-object JSON — e.g. the runtime script returned a bare string, an error array, or `null`; wrong script version returning a wrapped status differently.
Common situations: Editing the user-script runtime entrypoint so it echoes a plain-text/stringified message instead of a status object; a failing runtime that returns a JSON array of errors; older runtime scripts predating the object status contract.
Related errors
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/28385b507f3ea9d6.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/user_scripts.rs:42
"(() => JSON.stringify(window.__codexPlusUserScripts?.scripts || {}))()",
)
.await?;
parse_live_runtime_status_response(&response)
}
fn live_runtime_target(targets: &[crate::cdp::CdpTarget]) -> anyhow::Result<crate::cdp::CdpTarget> {
crate::cdp::pick_injectable_codex_page_target(targets)
}
fn parse_live_runtime_status_response(response: &Value) -> anyhow::Result<Value> {
let encoded = response
.pointer("/result/result/value")
.and_then(Value::as_str)
.context("user-script runtime probe returned no value")?;
let status: Value =
serde_json::from_str(encoded).context("invalid user-script runtime status JSON")?;
if !status.is_object() {
anyhow::bail!("user-script runtime status must be a JSON object");
}
Ok(status)
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
pub struct UserScriptConfig {
pub enabled: bool,
pub scripts: BTreeMap<String, bool>,
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub market: BTreeMap<String, MarketScriptInstall>,
}
impl Default for UserScriptConfig {
fn default() -> Self {
Self {
enabled: true,
scripts: BTreeMap::new(),
market: BTreeMap::new(),View on GitHub (pinned to b1ed92e5e4)