openai/codex · error
Numbered definition naming collision detected: schema=
Error message
Numbered definition naming collision detected: schema={schema_name}|container={defs_key}|generated={generated_name}|base={base_name} What it means
A build-time panic in detect_numbered_definition_collisions: after JSON-schema generation, a definition key that is a numbered variant of an existing base name (e.g. `Foo2` when `Foo` also exists) was found in the same `$defs` container. Two distinct generated definitions collapsed into colliding names, which would make one shadow the other in the emitted schema and produce wrong TypeScript types.
Solutions
- Rename one of the colliding protocol types/variants so generated definition names differ before numbering kicks in.
- Adjust the definition-naming scheme (namespace or logical_name) in the export pipeline so the two schemas land in separate defs containers.
- Treat the panic as a CI signal: fix the source type naming, never suppress the check.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/app-server-protocol/src/export.rs:1548 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/f9e3c94a5f868393.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/app-server-protocol/src/export.rs:1548
};
let name = name.split('/').next().unwrap_or(name);
if reachable.insert(name.to_string()) {
queue.push(name.to_string());
}
}
fn detect_numbered_definition_collisions(
schema_name: &str,
defs_key: &str,
defs: &Map<String, Value>,
) {
for generated_name in defs.keys() {
let base_name = generated_name.trim_end_matches(|c: char| c.is_ascii_digit());
if base_name == generated_name || !defs.contains_key(base_name) {
continue;
}
panic!(
"Numbered definition naming collision detected: schema={schema_name}|container={defs_key}|generated={generated_name}|base={base_name}"
);
}
}
pub(crate) fn write_json_schema<T>(out_dir: &Path, name: &str) -> Result<GeneratedSchema>
where
T: JsonSchema,
{
write_json_schema_with_return::<T>(out_dir, name)
}
fn write_pretty_json(path: PathBuf, value: &impl Serialize) -> Result<()> {
let json = serde_json::to_vec_pretty(value)
.with_context(|| format!("Failed to serialize JSON schema to {}", path.display()))?;
fs::write(&path, json).with_context(|| format!("Failed to write {}", path.display()))?;
Ok(())
}View on GitHub (pinned to 339751715c)