diff --git a/packages/opencode/src/tool/bash.ts b/packages/opencode/src/tool/bash.ts index f3a1b04d431..8cc1d0efbb0 100644 --- a/packages/opencode/src/tool/bash.ts +++ b/packages/opencode/src/tool/bash.ts @@ -95,6 +95,7 @@ export const BashTool = Tool.define("bash", async () => { for (let i = 0; i < node.childCount; i++) { const child = node.child(i) if (!child) continue + if ( child.type !== "command_name" && child.type !== "word" && @@ -107,6 +108,8 @@ export const BashTool = Tool.define("bash", async () => { command.push(child.text) } + if (command.length === 0) continue + // not an exhaustive list, but covers most common cases if (["cd", "rm", "cp", "mv", "mkdir", "touch", "chmod", "chown"].includes(command[0])) { for (const arg of command.slice(1)) {