Skip to content

Commit cbb591e

Browse files
authored
fix: more descriptive tool or subtask execution failed error (#5337)
Signed-off-by: Christian Stewart <christian@aperture.us>
1 parent e36c349 commit cbb591e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/opencode/src/session/prompt.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ export namespace SessionPrompt {
338338
},
339339
},
340340
})) as MessageV2.ToolPart
341+
let executionError: Error | undefined
341342
const result = await taskTool
342343
.execute(
343344
{
@@ -362,7 +363,11 @@ export namespace SessionPrompt {
362363
},
363364
},
364365
)
365-
.catch(() => {})
366+
.catch((error) => {
367+
executionError = error
368+
log.error("subtask execution failed", { error, agent: task.agent, description: task.description })
369+
return undefined
370+
})
366371
assistantMessage.finish = "tool-calls"
367372
assistantMessage.time.completed = Date.now()
368373
await Session.updateMessage(assistantMessage)
@@ -388,7 +393,7 @@ export namespace SessionPrompt {
388393
...part,
389394
state: {
390395
status: "error",
391-
error: "Tool execution failed",
396+
error: executionError ? `Tool execution failed: ${executionError.message}` : "Tool execution failed",
392397
time: {
393398
start: part.state.status === "running" ? part.state.time.start : Date.now(),
394399
end: Date.now(),

0 commit comments

Comments
 (0)