{"record":{"id":"3fb1f28078f58418","repo":"openai/codex","slug":"path-is-not-a-file","errorCode":null,"errorMessage":"path `{}` is not a file","messagePattern":"path `(.+?)` is not a file","errorType":"validation","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/exec-server/src/no_follow/windows.rs","lineNumber":212,"sourceCode":"    let handle = open_handle(\n        path,\n        FILE_READ_ATTRIBUTES,\n        FILE_OPEN,\n        /*create_options*/ 0,\n    )?;\n    Ok(std::fs::File::from(handle))\n}\n\nfn open_file_sync(path: &Path) -> io::Result<std::fs::File> {\n    let handle = open_handle(path, FILE_GENERIC_READ, FILE_OPEN, FILE_NON_DIRECTORY_FILE)?;\n    let file = std::fs::File::from(handle);\n    validate_regular_file(&file, path)?;\n    Ok(file)\n}\n\nfn validate_regular_file(file: &std::fs::File, path: &Path) -> io::Result<()> {\n    if !regular_file::is_disk_file(file) || !file.metadata()?.is_file() {\n        return Err(io::Error::new(\n            io::ErrorKind::InvalidInput,\n            format!(\"path `{}` is not a file\", path.display()),\n        ));\n    }\n    Ok(())\n}\n\npub(super) async fn open_file(path: PathBuf) -> io::Result<tokio::fs::File> {\n    tokio::task::spawn_blocking(move || open_file_sync(&path).map(tokio::fs::File::from_std))\n        .await\n        .map_err(|error| io::Error::other(format!(\"filesystem task failed: {error}\")))?\n}\n\npub(super) async fn write_file(path: PathBuf, contents: Vec<u8>) -> io::Result<()> {\n    tokio::task::spawn_blocking(move || {\n        let handle = open_handle(\n            &path,\n            FILE_READ_ATTRIBUTES | FILE_WRITE_DATA,","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/exec-server/src/no_follow/windows.rs#L194-L230","documentation":"Error \"path `{}` is not a file\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/exec-server/src/no_follow/windows.rs:212 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}