diff --git a/codex-rs/app-server-protocol/src/export.rs b/codex-rs/app-server-protocol/src/export.rs index 90978c31d2..ab70df79bd 100644 --- a/codex-rs/app-server-protocol/src/export.rs +++ b/codex-rs/app-server-protocol/src/export.rs @@ -195,8 +195,9 @@ pub fn generate_json(out_dir: &Path) -> Result<()> { definitions .entry(ns.to_string()) .or_insert_with(|| Value::Object(Map::new())); - if let Value::Object(defs_ns) = - definitions.get_mut(ns).expect("just inserted v2 namespace") + if let Value::Object(defs_ns) = definitions + .get_mut(ns) + .ok_or_else(|| anyhow!("just inserted v2 namespace"))? { defs_ns.insert(def_name, def_schema); } @@ -212,8 +213,9 @@ pub fn generate_json(out_dir: &Path) -> Result<()> { definitions .entry(ns.to_string()) .or_insert_with(|| Value::Object(Map::new())); - if let Value::Object(defs_ns) = - definitions.get_mut(ns).expect("just inserted v2 namespace") + if let Value::Object(defs_ns) = definitions + .get_mut(ns) + .ok_or_else(|| anyhow!("just inserted v2 namespace"))? { defs_ns.insert(logical_name.to_string(), schema_value); }