openai/codex · error · io::Error

at most {MAX_OPEN_FILE_READS} file reads may be open per con

Error message

at most {MAX_OPEN_FILE_READS} file reads may be open per connection

What it means

Error "at most {MAX_OPEN_FILE_READS} file reads may be open per connection" thrown in openai/codex.

Source

Thrown at codex-rs/exec-server/src/file_read.rs:37

    handles: Arc<Mutex<HashMap<String, Arc<File>>>>,
}

impl FileReadHandleManager {
    pub(crate) async fn open(
        &self,
        handle_id: String,
        file: tokio::fs::File,
    ) -> io::Result<String> {
        let file = Arc::new(file.into_std().await);
        let mut handles = self.handles.lock().await;
        if handles.contains_key(&handle_id) {
            return Err(io::Error::new(
                io::ErrorKind::InvalidInput,
                format!("file read handle `{handle_id}` already exists"),
            ));
        }
        if handles.len() >= MAX_OPEN_FILE_READS {
            return Err(io::Error::new(
                io::ErrorKind::InvalidInput,
                format!("at most {MAX_OPEN_FILE_READS} file reads may be open per connection"),
            ));
        }
        handles.insert(handle_id.clone(), file);
        Ok(handle_id)
    }

    pub(crate) async fn read_block(
        &self,
        handle_id: &str,
        offset: u64,
        len: usize,
    ) -> io::Result<FileReadBlock> {
        validate_read_block_len(len)?;
        let file = {
            let handles = self.handles.lock().await;
            handles

View on GitHub (pinned to 339751715c)

Solutions

  1. Close open file reads before opening new ones.

When it happens

Trigger: Thrown at codex-rs/exec-server/src/file_read.rs:37 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/144f850cd0a0fe93. Report an issue: GitHub.