Skip to content

Commit 1a9d1fe

Browse files
committed
Add error handling for concurrent server retry path
1 parent a0d4a5e commit 1a9d1fe

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

packages/sandbox/src/opencode/opencode.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,20 @@ async function ensureOpencodeServer(
124124
);
125125
// Wait for the concurrent server to be ready
126126
if (retryProcess.status === 'starting') {
127-
await retryProcess.waitForPort(port, {
128-
mode: 'http',
129-
path: '/',
130-
timeout: 60_000
131-
});
127+
try {
128+
await retryProcess.waitForPort(port, {
129+
mode: 'http',
130+
path: '/',
131+
timeout: 60_000
132+
});
133+
} catch (e) {
134+
const logs = await retryProcess.getLogs();
135+
throw new OpencodeStartupError(
136+
`OpenCode server failed to start. Stderr: ${logs.stderr || '(empty)'}`,
137+
{ port, stderr: logs.stderr, command: retryProcess.command },
138+
{ cause: e }
139+
);
140+
}
132141
}
133142
return retryProcess;
134143
}

0 commit comments

Comments
 (0)