{"record":{"id":"3b7ac8e081f1abea","repo":"nikivdev/code","slug":"external-codex-browser-exited-unsuccessfully-with","errorCode":null,"errorMessage":"external codex browser exited unsuccessfully with status {}","messagePattern":"external codex browser exited unsuccessfully with status (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/ai.rs","lineNumber":5418,"sourceCode":"    )?;\n    command\n        .stdin(Stdio::inherit())\n        .stdout(Stdio::inherit())\n        .stderr(Stdio::inherit())\n        .env(\n            \"CODEX_SESSION_BROWSER_CODEX_BIN\",\n            configured_codex_bin_for_workdir(&target),\n        );\n\n    let status = command.status().with_context(|| {\n        format!(\n            \"failed to launch external codex browser from {}\",\n            tool.manifest_path.display()\n        )\n    })?;\n\n    if !status.success() {\n        bail!(\n            \"external codex browser exited unsuccessfully with status {}\",\n            status\n        );\n    }\n\n    let selected_id = fs::read_to_string(selection_file.path())\n        .with_context(|| \"failed to read codex browser selection file\")?;\n    let selected_id = selected_id.trim();\n    if selected_id.is_empty() {\n        return Ok(());\n    }\n\n    resume_session(\n        Some(selected_id.to_string()),\n        Some(target.display().to_string()),\n        Provider::Codex,\n    )\n}","sourceCodeStart":5400,"sourceCodeEnd":5436,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/ai.rs#L5400-L5436","documentation":"When the external codex browser helper (launched from its manifest via a tool descriptor) finishes with a non-zero exit status, the browse flow in src/ai.rs:5418 bails with this message embedding the status code. The selection file it was supposed to write cannot be trusted, so the browse operation fails loudly instead of returning a bogus session selection.","triggerScenarios":"The spawned external browser process returns a non-success exit status — browser crashed, user aborted the picker with an error exit, missing manifest dependencies, or the tool manifest points to a broken/failed script.","commonSituations":"External browser tool not built/installed correctly; terminal closed or signal killed the picker; script bug in the external browser causing non-zero exit; disk/permission error writing the selection file inside the browser.","solutions":["Re-run `f ai codex browse` — transient aborts/crashes often succeed on retry","Verify the external browser tool and its manifest_path are intact and executable","Run the external browser directly to see its real error output and fix the underlying cause","Check exit status shown: non-zero codes from user cancellation may simply mean pick a session without cancelling"],"exampleFix":"// before: manifest points at a missing script\n{\"bin\": \"./target/debug/missing-browser\"}\n// after: rebuilt/valid manifest path\n{\"bin\": \"./target/release/codex-browser\"}","handlingStrategy":"retry","validationCode":"let manifest = PathBuf::from(&manifest_path);\nif !manifest.exists() {\n    eprintln!(\"External codex browser manifest missing at {}\", manifest.display());\n    return;\n}","typeGuard":"fn browser_ready(manifest_path: &Path) -> bool {\n    manifest_path.exists()\n}","tryCatchPattern":"match browse_codex_sessions(path, query, Provider::Codex) {\n    Err(e) if e.to_string().contains(\"exited unsuccessfully with status\") => {\n        eprintln!(\"{e} — retrying once; if it persists, run the browser tool directly to see its stderr\");\n        // retry or inspect the external tool\n    }\n    other => other?,\n}","preventionTips":["Build/install the external browser tool before browsing","Pick a session instead of cancelling with an error exit code","Test the browser manifest path after rebuilding the project","Check selection-file write permissions in temp dirs"],"tags":["cli","external-process","exit-status"],"backgroundTag":"child-process-exited-nonzero","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}