openai/codex · error · serde_json::Error

tool input schema must not be a singleton null type

Error message

tool input schema must not be a singleton null type

What it means

Schema-validation guard in the tool JSON-schema machinery: a tool declared its input schema as the singleton type "null" (only null is a valid input). Such a schema cannot accept any meaningful arguments, so singleton_null_schema_error rejects it at registration/serialization time.

Solutions

  1. Give the tool a real input schema (e.g. an object type with parameters, or an empty-object schema if it takes no arguments)
  2. Remove the "type": ["null"]-only declaration from the tool definition
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/tools/src/json_schema.rs:796 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/6a7b1f34103ee921. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/tools/src/json_schema.rs:796

        "null" => Some(JsonSchemaPrimitiveType::Null),
        _ => None,
    }
}

fn schema_type_name(schema_type: JsonSchemaPrimitiveType) -> &'static str {
    match schema_type {
        JsonSchemaPrimitiveType::String => "string",
        JsonSchemaPrimitiveType::Number => "number",
        JsonSchemaPrimitiveType::Boolean => "boolean",
        JsonSchemaPrimitiveType::Integer => "integer",
        JsonSchemaPrimitiveType::Object => "object",
        JsonSchemaPrimitiveType::Array => "array",
        JsonSchemaPrimitiveType::Null => "null",
    }
}

fn singleton_null_schema_error() -> serde_json::Error {
    serde_json::Error::io(std::io::Error::new(
        std::io::ErrorKind::InvalidInput,
        "tool input schema must not be a singleton null type",
    ))
}

#[cfg(test)]
#[path = "json_schema_tests.rs"]
mod tests;

View on GitHub (pinned to 339751715c)