openai/codex · error · OpenAiFileError

file `{file_name}` is too large: {size_bytes} bytes exceeds

Error message

file `{file_name}` is too large: {size_bytes} bytes exceeds the limit of {limit_bytes} bytes

What it means

Error "file `{file_name}` is too large: {size_bytes} bytes exceeds the limit of {limit_bytes} bytes" thrown in openai/codex.

Source

Thrown at codex-rs/codex-api/src/files.rs:44

pub struct HostedFileUploadContext {
    pub connector_id: String,
    pub action_name: String,
    pub model: String,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct UploadedOpenAiFile {
    pub file_id: String,
    pub uri: String,
    pub download_url: String,
    pub file_name: String,
    pub file_size_bytes: u64,
    pub mime_type: Option<String>,
}

#[derive(Debug, thiserror::Error)]
pub enum OpenAiFileError {
    #[error(
        "file `{file_name}` is too large: {size_bytes} bytes exceeds the limit of {limit_bytes} bytes"
    )]
    FileTooLarge {
        file_name: String,
        size_bytes: u64,
        limit_bytes: u64,
    },
    #[error("failed to send OpenAI file request to {url}: {source}")]
    Request {
        url: String,
        #[source]
        source: RouteAwareRequestError,
    },
    #[error(
        "OpenAI file blob upload to {host} failed after {elapsed_ms} ms ({error_kind}, azure_client_request_id={azure_client_request_id}): {source}"
    )]
    BlobUploadRequest {
        host: String,

View on GitHub (pinned to 339751715c)

When it happens

Trigger: Thrown at codex-rs/codex-api/src/files.rs:44 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/f3e07418d57d579f. Report an issue: GitHub.