{"record":{"id":"34de920c18fe494c","repo":"vercel/ai","slug":"harness-input-harness-harnessid-could-not-ex","errorCode":null,"errorMessage":"`Harness '${input.harness.harnessId}' could not execute host tool '${toolCall.toolName}'.`","messagePattern":"`Harness '(.+?)' could not execute host tool '(.+?)'\\.`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/harness/src/agent/internal/run-prompt.ts","lineNumber":1083,"sourceCode":"                      result: preliminaryOutput as Extract<\n                        HarnessV1StreamPart,\n                        { type: 'tool-result' }\n                      >['result'],\n                    },\n                    input.sessionWorkDir,\n                  ) as Extract<HarnessV1StreamPart, { type: 'tool-result' }>;\n                  result.enqueue({\n                    type: 'tool-result',\n                    toolCallId: toolCall.toolCallId,\n                    toolName: toolCall.toolName,\n                    input: undefined,\n                    output: stripped.result,\n                    preliminary: true,\n                  } as TextStreamPart<TOOLS>);\n                },\n              });\n              if (!execution.executed) {\n                throw new Error(\n                  `Harness '${input.harness.harnessId}' could not execute host tool '${toolCall.toolName}'.`,\n                );\n              }\n              await telemetry.toolEnd(toolCall.toolCallId, execution.outcome);\n            })(),\n          );\n        }\n      }\n      await waitForOutstandingHostToolExecutions();\n      const isTurnSuspending = input.isTurnSuspending?.() === true;\n      if (isTurnSuspending) {\n        if (finalFinish == null) {\n          /*\n           * A timed slice may stop in the middle of a model step. Its partial\n           * content remains in the bridge replay log for the next slice, but it\n           * cannot form a valid StepResult in this slice because no finish-step\n           * has arrived yet.\n           */","sourceCodeStart":1065,"sourceCodeEnd":1101,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness/src/agent/internal/run-prompt.ts#L1065-L1101","documentation":"The SDK attempted to execute a host-side (custom, non-provider-executed) tool requested by the harness, but the execution wrapper reported `executed: false` — i.e. no tool executor ran for this tool call. This indicates the tool could not be dispatched (no matching executor available for `toolCall.toolName`) and the run cannot produce a tool result, so runPrompt throws.","triggerScenarios":"During host tool execution inside runPrompt, `execution.executed` is false after invoking the tool execution machinery — the tool name has no registered executor/implementation in the active toolset or execution was refused.","commonSituations":"The harness requests a tool that was filtered out or not declared in `tools`; typos or casing differences in tool names between harness config and SDK toolset; toolset swapped between steps so a previously available tool vanished; provider-executed vs host-executed flag mismatch.","solutions":["Ensure every tool the harness can request is declared in the agent's `tools` with an executable `execute` implementation.","Verify tool names match exactly (case-sensitive) between harness configuration and the SDK toolset.","Check `builtinToolFiltering`/tool filters are not excluding a tool the harness still tries to call.","Keep the toolset stable across all steps of the run."],"exampleFix":"// before\nnew HarnessAgent({ tools: { read_file: readFileTool } }); // harness calls 'bash'\n\n// after\nnew HarnessAgent({ tools: { read_file: readFileTool, bash: bashTool } });","handlingStrategy":"validation","validationCode":"for (const name of harnessRequestedToolNames) {\n  if (!hasTool({ tools: activeTools, toolName: name })) {\n    throw new Error(`Harness may request tool '${name}' which is not in the active toolset.`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await agent.run(...);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('could not execute host tool')) {\n    // add the missing tool or correct its name/filtering\n  }\n  throw e;\n}","preventionTips":["Declare every tool the harness can invoke with an `execute` implementation.","Match tool names exactly (case-sensitive) between harness config and toolset.","Verify tool filters do not exclude harness-requested tools."],"tags":["harness","host-tool","tool-execution","toolset"],"backgroundTag":"tool-not-executable","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}