{"record":{"id":"b6f9759c15a7bc37","repo":"BigPizzaV3/CodexPlusPlus","slug":"macos-bundle-binary-is-not-a-regular-file","errorCode":null,"errorMessage":"macOS bundle binary is not a regular file: {}","messagePattern":"macOS bundle binary is not a regular file: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/install/macos.rs","lineNumber":147,"sourceCode":"    let executable = macos.join(executable_name_from_plist(&bundle.info_plist));\n    fs::write(&executable, &bundle.launch_script)?;\n    let mut permissions = fs::metadata(&executable)?.permissions();\n    permissions.set_mode(0o755);\n    fs::set_permissions(executable, permissions)?;\n    copy_icon(&resources)?;\n    Ok(())\n}\n\n#[cfg(target_os = \"macos\")]\nfn validate_binary_source(path: &Path) -> anyhow::Result<()> {\n    let metadata = fs::metadata(path).map_err(|error| {\n        anyhow::anyhow!(\n            \"macOS bundle binary is unavailable at {}: {error}\",\n            path.display()\n        )\n    })?;\n    if !metadata.is_file() {\n        anyhow::bail!(\n            \"macOS bundle binary is not a regular file: {}\",\n            path.display()\n        );\n    }\n    if metadata.len() < 1024 {\n        anyhow::bail!(\n            \"macOS bundle binary is unexpectedly small: {}\",\n            path.display()\n        );\n    }\n    let mut header = [0_u8; 2];\n    let mut file = fs::File::open(path)?;\n    use std::io::Read;\n    let read = file.read(&mut header)?;\n    if read == header.len() && header == *b\"#!\" {\n        anyhow::bail!(\n            \"macOS bundle binary points to a shell script: {}\",\n            path.display()","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/install/macos.rs#L129-L165","documentation":"Thrown by validate_binary_source in crates/codex-plus-core/src/install/macos.rs when the macOS app-bundle's embedded Codex++ binary path exists but its filesystem metadata says it is not a regular file (e.g. a directory, symlink-to-directory, fifo, or device). The install step validates the source binary before writing it into the bundle so a corrupt bundle is never produced.","triggerScenarios":"Calling write_bundle (via install_entrypoints/install_app_bundles on macOS) when the source binary path passes fs::metadata().exists() but !metadata.is_file() — e.g. the path points at a directory or special file instead of the compiled binary.","commonSituations":"A build/packaging script left a directory where the binary should be; a misconfigured settings path points to the bundle's Contents/MacOS folder itself; a leftover named pipe or symlink from a previous partial install; stale config pointing at a resources dir rather than the executable.","solutions":["Check the configured binary path with `ls -la` and confirm it is a regular file, not a directory or special file","Rebuild or re-download the Codex++ binary so a real executable exists at the expected path","Fix the install options/path config so it points to the actual binary inside Contents/MacOS","Remove stale non-file artifacts (symlinks, fifos, dirs) at that path before re-running install"],"exampleFix":"// before: passing a directory as the binary source\ninstall(InstallOptions { binary: PathBuf::from(\"/app/CodexPlusPlus.app/Contents/MacOS\"), .. })\n// after: point at the regular-file executable\ninstall(InstallOptions { binary: PathBuf::from(\"/app/CodexPlusPlus.app/Contents/MacOS/codex-plus\"), .. })","handlingStrategy":"validation","validationCode":"let meta = std::fs::metadata(&path).map_err(|e| format!(\"binary missing: {e}\"))?;\nif !meta.is_file() { return Err(format!(\"{} is not a regular file\", path.display())); }","typeGuard":"fn is_regular_file(p: &Path) -> bool {\n    std::fs::metadata(p).map(|m| m.is_file()).unwrap_or(false)\n}","tryCatchPattern":null,"preventionTips":["Always run `file <path>` on the binary source before packaging","Point install options at the executable file, never its parent directory","Add a pre-install script that fails fast on non-regular-file binaries","Clean stale symlinks/fifos from build output dirs"],"tags":["macos","install","filesystem"],"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"}