{"record":{"id":"b7ff9752a641e21f","repo":"BigPizzaV3/CodexPlusPlus","slug":"macos-bundle-is-missing-its-binary-source","errorCode":null,"errorMessage":"macOS bundle is missing its binary source","messagePattern":"macOS bundle is missing its binary source","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/install/macos.rs","lineNumber":127,"sourceCode":"fn write_bundle(bundle: &MacosAppBundle) -> anyhow::Result<()> {\n    let contents = bundle.app_path.join(\"Contents\");\n    let macos = contents.join(\"MacOS\");\n    let resources = contents.join(\"Resources\");\n    fs::create_dir_all(&macos)?;\n    fs::create_dir_all(&resources)?;\n    fs::write(contents.join(\"Info.plist\"), &bundle.info_plist)?;\n    if let (Some(source), Some(target_name)) = (&bundle.binary_source, &bundle.binary_target_name) {\n        validate_binary_source(source)?;\n        let target = macos.join(target_name);\n        if source != &target {\n            fs::copy(source, &target)?;\n        }\n        validate_binary_source(&target)?;\n        let mut permissions = fs::metadata(&target)?.permissions();\n        permissions.set_mode(0o755);\n        fs::set_permissions(target, permissions)?;\n    } else {\n        anyhow::bail!(\"macOS bundle is missing its binary source\");\n    }\n    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    })?;","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/install/macos.rs#L109-L145","documentation":"write_bundle assembles a macOS .app bundle by copying the compiled binary into Contents/MacOS and then writing a launch script next to it. If the bundle definition has no binary source (no source path resolved for the executable), there is nothing to copy, so it bails rather than producing a broken bundle.","triggerScenarios":"install_app_bundles → write_bundle called with a MacosAppBundle whose binary source is absent: the binary was not built before install, the source path in InstallOptions points to a nonexistent file, or the bundle struct was constructed without setting the binary source field.","commonSituations":"Running 'install' before 'cargo build --release'; renaming or moving the target/ binary so the recorded path no longer resolves; hand-constructing MacosAppBundle in tests without the binary field.","solutions":["Build the release binary before running the installer","Verify the configured binary source path exists and pass it into the bundle definition","Check how MacosAppBundle is constructed — ensure the binary source field is populated"],"exampleFix":"// before\nlet bundle = MacosAppBundle { info_plist, launch_script, ..Default::default() }; // no binary source\n// after\nassert!(binary_source.exists(), \"build the binary first\");\nlet bundle = MacosAppBundle { binary_source, info_plist, launch_script };","handlingStrategy":"validation","validationCode":"if !bundle.binary_source.exists() { return Err(anyhow!(\"binary not built at {:?}\", bundle.binary_source)); }","typeGuard":"fn has_binary_source(bundle: &MacosAppBundle) -> bool { bundle.binary_source.as_ref().map(|p| p.exists()).unwrap_or(false) }","tryCatchPattern":"match install_app_bundles(&opts) { Err(e) if e.to_string().contains(\"missing its binary source\") => eprintln!(\"run the build step first\"), ... }","preventionTips":["Always build (cargo build --release) before installing bundles","Validate binary_source.exists() before constructing the bundle","In CI, make the build step an explicit prerequisite of the install step"],"tags":["macos","packaging","missing-file"],"backgroundTag":"file-not-found","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"}