{"record":{"id":"442c50b2f8a4545f","repo":"BigPizzaV3/CodexPlusPlus","slug":"macos-bundle-binary-points-to-a-shell-script","errorCode":null,"errorMessage":"macOS bundle binary points to a shell script: {}","messagePattern":"macOS bundle binary points to a shell script: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/install/macos.rs","lineNumber":163,"sourceCode":"    })?;\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()\n        );\n    }\n    Ok(())\n}\n\n#[cfg(target_os = \"macos\")]\nfn copy_icon(resources: &Path) -> anyhow::Result<()> {\n    let source = std::env::current_exe()\n        .ok()\n        .and_then(|path| path.parent().map(Path::to_path_buf))\n        .map(|path| path.join(\"codex-plus-plus.png\"));\n    if let Some(source) = source.filter(|path| path.exists()) {\n        fs::copy(source, resources.join(\"codex-plus-plus.png\"))?;\n    }\n    Ok(())\n}","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/install/macos.rs#L145-L181","documentation":"Thrown by validate_binary_source (cfg macos) when the first two bytes of the binary source are the shebang sequence '#!'. A real Mach-O executable never starts with '#!'; this catches launch scripts or wrapper shell files mistakenly configured as the bundle binary. The offending input is the file at the given path whose header was sniffed.","triggerScenarios":"Thrown at crates/codex-plus-core/src/install/macos.rs:163 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["用真实编译产物替换脚本文件","检查构建流程是否误把启动脚本当二进制"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}