openai/codex · error · io::Error

file is too large to read: limit is {MAX_READ_FILE_BYTES} by

Error message

file is too large to read: limit is {MAX_READ_FILE_BYTES} bytes

What it means

Error "file is too large to read: limit is {MAX_READ_FILE_BYTES} bytes" thrown in openai/codex.

Source

Thrown at codex-rs/exec-server/src/local_file_system.rs:48

use crate::FileSystemSandboxContext;
use crate::GetMetadataOptions;
use crate::ReadDirectoryEntry;
use crate::ReadFileOptions;
use crate::RemoveOptions;
use crate::WalkEntry;
use crate::WalkEntryKind;
use crate::WalkError;
use crate::WalkOptions;
use crate::WalkOutcome;
use crate::WriteFileOptions;
use crate::no_follow;
use crate::regular_file;
use crate::sandboxed_file_system::SandboxedFileSystem;

const MAX_READ_FILE_BYTES: u64 = 512 * 1024 * 1024;

fn file_too_large_error() -> io::Error {
    io::Error::new(
        io::ErrorKind::InvalidInput,
        format!("file is too large to read: limit is {MAX_READ_FILE_BYTES} bytes"),
    )
}

pub static LOCAL_FS: LazyLock<Arc<dyn ExecutorFileSystem>> =
    LazyLock::new(|| -> Arc<dyn ExecutorFileSystem> { Arc::new(LocalFileSystem::unsandboxed()) });

#[derive(Clone, Default)]
pub(crate) struct DirectFileSystem;

#[derive(Clone, Default)]
pub(crate) struct UnsandboxedFileSystem {
    file_system: DirectFileSystem,
}

#[derive(Clone, Default)]
pub struct LocalFileSystem {

View on GitHub (pinned to 339751715c)

Solutions

  1. Read the file in ranged chunks below the byte limit.

When it happens

Trigger: Thrown at codex-rs/exec-server/src/local_file_system.rs:48 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/b1180d0e49aaabc9. Report an issue: GitHub.