{"record":{"id":"d5eee43fcc9340f8","repo":"vercel/ai","slug":"tool-approval-was-requested-but-the-renderer-does","errorCode":null,"errorMessage":"Tool approval was requested, but the renderer does not support tool approval input.","messagePattern":"Tool approval was requested, but the renderer does not support tool approval input\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tui/src/agent-tui-runner.ts","lineNumber":177,"sourceCode":"      try {\n        const responseMessage = await this.renderer.renderStream(result, {\n          title,\n          submittedPrompt: prompt,\n          continueSession: Boolean(this.renderer.readPrompt),\n          tools: this.tools,\n          reasoning: this.reasoning,\n          responseStatistics: this.responseStatistics,\n          contextSize: this.contextSize,\n          waitForExit: false,\n        });\n\n        if (responseMessage && responseMessage.parts.length > 0) {\n          const approvalRequests =\n            findPendingToolApprovalRequests(responseMessage);\n\n          if (approvalRequests.length > 0) {\n            if (!this.renderer.readToolApproval) {\n              throw new Error(\n                'Tool approval was requested, but the renderer does not support tool approval input.',\n              );\n            }\n\n            for (const request of approvalRequests) {\n              const response = await this.renderer.readToolApproval(request, {\n                title,\n              });\n              applyToolApprovalResponse(responseMessage, request, response);\n            }\n\n            upsertResponseMessage(\n              messages,\n              responseMessage,\n              streamWithoutPrompt,\n            );\n            streamWithoutPrompt = true;\n            prompt = undefined;","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/tui/src/agent-tui-runner.ts#L159-L195","documentation":"During run(), if the agent's response message contains pending tool approval requests, the runner requires a renderer that implements readToolApproval to ask the user. If the renderer lacks that capability, it throws this error instead of silently approving or denying a tool.","triggerScenarios":"An agent turn requests tool approval (e.g. a tool with needApproval) while the active TUI renderer does not implement readToolApproval.","commonSituations":"Using a headless/non-interactive renderer with tools that require approval; forgetting to wire an approval handler in a custom renderer; adding approval-required tools after choosing a minimal renderer.","solutions":["Use a renderer that implements readToolApproval.","Provide an approval handler, or configure tools to not require approval.","Pre-check renderer.readToolApproval before running tools with approval requirements.","Auto-approve explicitly if running unattended (accepting the risk)."],"exampleFix":"// before\nconst renderer = { readPrompt: async () => 'hi' };\n// after\nconst renderer = {\n  readPrompt: async () => 'hi',\n  readToolApproval: async request => ({\n    approvalId: request.approvalId,\n    approved: true,\n  }),\n};","handlingStrategy":"validation","validationCode":"if (!renderer.readToolApproval) {\n  throw new Error('Renderer must implement readToolApproval for approval-required tools.');\n}","typeGuard":"null","tryCatchPattern":"try {\n  await runner.run();\n} catch (error) {\n  if (error.message.includes('does not support tool approval')) {\n    // switch renderer or disable approval-required tools\n  } else throw error;\n}","preventionTips":["Implement readToolApproval in any renderer used with approval tools.","Document renderer capability requirements.","Disable needApproval on tools when running unattended.","Test approval flows with the target renderer."],"tags":["tui","tool-approval","renderer","config"],"backgroundTag":"missing-required-argument","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}