{"record":{"id":"043fa817297942f8","repo":"openai/codex","slug":"file-read-handle-handle-id-already-exists","errorCode":null,"errorMessage":"file read handle `{handle_id}` already exists","messagePattern":"file read handle `(.+?)` already exists","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/exec-server/src/file_read.rs","lineNumber":31,"sourceCode":"    pub(crate) bytes: Vec<u8>,\n    pub(crate) eof: bool,\n}\n\n#[derive(Clone, Default)]\npub(crate) struct FileReadHandleManager {\n    handles: Arc<Mutex<HashMap<String, Arc<File>>>>,\n}\n\nimpl FileReadHandleManager {\n    pub(crate) async fn open(\n        &self,\n        handle_id: String,\n        file: tokio::fs::File,\n    ) -> io::Result<String> {\n        let file = Arc::new(file.into_std().await);\n        let mut handles = self.handles.lock().await;\n        if handles.contains_key(&handle_id) {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidInput,\n                format!(\"file read handle `{handle_id}` already exists\"),\n            ));\n        }\n        if handles.len() >= MAX_OPEN_FILE_READS {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidInput,\n                format!(\"at most {MAX_OPEN_FILE_READS} file reads may be open per connection\"),\n            ));\n        }\n        handles.insert(handle_id.clone(), file);\n        Ok(handle_id)\n    }\n\n    pub(crate) async fn read_block(\n        &self,\n        handle_id: &str,\n        offset: u64,","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/exec-server/src/file_read.rs#L13-L49","documentation":"Error \"file read handle `{handle_id}` already exists\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/exec-server/src/file_read.rs:31 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a unique handle_id, or close the existing file read first."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}