{"record":{"id":"cb4727ac5b59f984","repo":"BigPizzaV3/CodexPlusPlus","slug":"file-is-a-reparse-point","errorCode":null,"errorMessage":"File is a reparse point","messagePattern":"File is a reparse point","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/native_browser.rs","lineNumber":180,"sourceCode":"    }\n    Ok(guards)\n}\n\nfn read_regular(path: &Path, limit: u64) -> Result<Vec<u8>> {\n    let _guards = pin_parents(path)?;\n    let mut options = OpenOptions::new();\n    options.read(true);\n    #[cfg(windows)]\n    {\n        use std::os::windows::fs::OpenOptionsExt;\n        options.share_mode(0x1).custom_flags(0x00200000);\n    }\n    let file = options.open(path)?;\n    let meta = file.metadata()?;\n    #[cfg(windows)]\n    {\n        use std::os::windows::fs::MetadataExt;\n        ensure!(\n            meta.file_attributes() & 0x400 == 0,\n            \"File is a reparse point\"\n        );\n    }\n    ensure!(\n        meta.is_file() && meta.len() <= limit,\n        \"Unexpected file type or size\"\n    );\n    let mut bytes = Vec::new();\n    file.take(limit + 1).read_to_end(&mut bytes)?;\n    ensure!(\n        bytes.len() as u64 <= limit,\n        \"File grew beyond the size limit\"\n    );\n    Ok(bytes)\n}\n\nfn write_new(path: &Path, bytes: &[u8]) -> Result<File> {","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/native_browser.rs#L162-L198","documentation":"read_regular opens the target file itself with OPEN_REPARSE_POINT so it receives the reparse-point metadata rather than following the link, then rejects the file if FILE_ATTRIBUTE_REPARSE_POINT (0x400) is set. This library only reads ordinary regular files of the browser runtime it patches; reading through a symlink/junction would defeat the integrity guarantees (hash pinning) of the adaptation. Any linked file is treated as unsupported.","triggerScenarios":"Any read path (discover, prepare, recovery_material, restore_all, read_status, verify_restored_state) where the target file — e.g. bin/node_repl.exe, bin/node.exe, manifest.json, or browser-service.mjs — is a symlink, hardlink-with-reparse-tag, or other NTFS reparse point.","commonSituations":"Developer copies the runtime with a tool that created symlinks; the installation was cloned from another machine using symlink-capable software; pnpm/npm-style linking habits applied to runtime files; version upgrades replaced a file with a link to a shared copy.","solutions":["Replace the linked file with a real copy: copy the target's contents to a fresh regular file at the path (del the link, then copy).","Reinstall or repair the Codex runtime so all files under the runtime root are plain regular files.","Verify with `fsutil reparsepoint query <file>` or `dir /AL` which files are reparse points, and fix each one before retrying.","Avoid tools that materialize the runtime as symlinks (e.g. package-manager linking) when staging this directory."],"exampleFix":"// before: file is a symlink to a shared copy\nbrowser-service.mjs -> D:\\shared\\browser-service.mjs\n// after: materialize a real file\ncp --remove-destination D:\\shared\\browser-service.mjs browser-service.mjs","handlingStrategy":"validation","validationCode":"fn assert_regular_file(path: &Path) -> std::io::Result<()> {\n    let meta = std::fs::symlink_metadata(path)?;\n    if meta.file_type().is_symlink() {\n        return Err(std::io::Error::new(\n            std::io::ErrorKind::InvalidInput,\n            format!(\"{} is a symlink\", path.display()),\n        ));\n    }\n    #[cfg(windows)]\n    {\n        use std::os::windows::fs::MetadataExt;\n        if meta.file_attributes() & 0x400 != 0 {\n            return Err(std::io::Error::new(\n                std::io::ErrorKind::InvalidInput,\n                format!(\"{} is a reparse point\", path.display()),\n            ));\n        }\n    }\n    if !meta.is_file() {\n        return Err(std::io::Error::new(\n            std::io::ErrorKind::InvalidInput,\n            format!(\"{} is not a regular file\", path.display()),\n        ));\n    }\n    Ok(())\n}","typeGuard":"fn is_plain_file(p: &Path) -> bool {\n    match std::fs::symlink_metadata(p) {\n        Ok(m) => m.is_file() && !m.file_type().is_symlink(),\n        Err(_) => false,\n    }\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"reparse point\") => {\n        eprintln!(\"Replace the linked file with a real copy before retrying: {e}\");\n    }\n    Err(e) => return Err(e.into()),\n    Ok(bytes) => process(bytes),\n}","preventionTips":["Copy runtime files with copy semantics, not link semantics (avoid cp -s, pnpm-style linking)","After cloning/moving an installation, verify no entries are symlinks (`dir /AL` or find -type l)","Reinstall the runtime from an official installer rather than hand-copying trees between machines","Check fsutil reparsepoint query on files the library reads"],"tags":["windows","filesystem","symlink","security"],"backgroundTag":"incompatible-source-type","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}