{"record":{"id":"572be09cea28a4ab","repo":"moeru-ai/airi","slug":"tool-toolname-not-found","errorCode":null,"errorMessage":"Tool '${toolName}' not found","messagePattern":"Tool '(.+?)' not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"integrations/minecraft/src/debug/tool-executor.ts","lineNumber":58,"sourceCode":"  private sendToolsList(): void {\n    try {\n      const tools = this.extractToolDefinitions()\n      console.log(`[ToolExecutor] Sending ${tools.length} tools`)\n      this.debugService.emit('debug:tools_list', { tools })\n    }\n    catch (err) {\n      console.error('[ToolExecutor] Error sending tool list:', err)\n    }\n  }\n\n  private async executeTool(toolName: string, params: Record<string, unknown>): Promise<void> {\n    try {\n      // Check if action is blocked\n      // TODO: Add check for running agent if needed\n\n      const action = actionsList.find(a => a.name === toolName)\n      if (!action) {\n        throw new Error(`Tool '${toolName}' not found`)\n      }\n\n      // Validate params\n      const validated = action.schema.parse(params)\n\n      // Execute\n      // The perform function in existing tools often returns a function that returns a Promise (or value)\n      // perform: (mineflayer) => async (args) => result\n      const performer = action.perform(this.mineflayer)\n\n      const args: any[] = []\n      const shape = (action.schema as any).shape\n      for (const key in shape) {\n        if (Object.hasOwn(validated, key)) {\n          args.push((validated as any)[key])\n        }\n      }\n","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/integrations/minecraft/src/debug/tool-executor.ts#L40-L76","documentation":"Thrown by ToolExecutor.executeTool() in the debug subsystem. executeTool looks up the requested toolName in the static actionsList (imported from cognitive/action/llm-actions) via .find(a => a.name === toolName). If no action with that exact name exists, it throws. The surrounding try/catch catches it and emits a debug:tool_result event with the error string, so the debug UI shows the failure rather than crashing.","triggerScenarios":"The debug UI/panel sends an execute_tool command with a toolName not present in actionsList; a typo or outdated tool name in the debug request; the action list was filtered or not yet populated when the request arrived; case mismatch between the UI's tool name and the registered name.","commonSituations":"Debug panel populated from a stale tool list after actions were added/removed; a custom debug client sends an arbitrary name; actionsList imported from a module that was tree-shaken or not fully initialised.","solutions":["Refresh the tool list in the debug UI via request_tools before executing, so the name matches the live actionsList.","Verify exact name and casing against actionsList.map(a => a.name).","If the action should exist, confirm it is exported/registered in cognitive/action/llm-actions.","Handle the debug:tool_result error event in the UI to surface the mismatch."],"exampleFix":"// before (debug client sends a stale name)\n//   { type: 'execute_tool', payload: { toolName: 'collect_block', params: {} } }\n//\n// after\n//   { type: 'execute_tool', payload: { toolName: 'collectBlocks', params: { blockType: 'stone', num: 1 } } }","handlingStrategy":"validation","validationCode":"import { actionsList } from '../cognitive/action/llm-actions'\n\nconst knownNames = new Set(actionsList.map(a => a.name))\n\nexport function isKnownDebugTool(name: string): boolean {\n  return knownNames.has(name)\n}\n\n// before dispatching execute_tool:\n// if (!isKnownDebugTool(payload.toolName)) { emit error; return }","typeGuard":"function isRegisteredTool(name: string): name is string {\n  return actionsList.some(a => a.name === name)\n}","tryCatchPattern":null,"preventionTips":["Refresh the debug UI tool list via request_tools before executing.","Match exact name and casing against actionsList.","Surface the debug:tool_result error event in the UI so mismatches are visible.","Confirm new actions are exported from cognitive/action/llm-actions."],"tags":["debug","tool-executor","unknown-tool","actions-list"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}