Skip to content

Commit f431854

Browse files
anandgupta42claude
andcommitted
fix: handle spawn error when Python binary is missing
Add an `error` event handler on the child process so the CLI doesn't crash with an unhandled exception if the Python executable can't be found (e.g., corrupted venv). Flagged by Sentry review. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8400a72 commit f431854

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

packages/altimate-code/src/bridge/client.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ export namespace Bridge {
105105
if (msg) console.error(`[altimate-engine] ${msg}`)
106106
})
107107

108+
child.on("error", (err) => {
109+
for (const [id, p] of pending) {
110+
p.reject(new Error(`Failed to start Python engine: ${err.message}`))
111+
pending.delete(id)
112+
}
113+
child = undefined
114+
})
115+
108116
child.on("exit", (code) => {
109117
if (code !== 0) restartCount++
110118
for (const [id, p] of pending) {

0 commit comments

Comments
 (0)