Answer: Return errors as structured data rather than throwing, using an output object with an error message and isError: true. When a tool returns an error, the agent sees it and can adjust its approach, whereas throwing counts as a "mistake" and increments the consecutive mistake counter. Status: Confirmed Entry: tool/cline/agents-and-automation/custom-tool-error-handling Revision: 1 Digest: sha256:4c38ad3ea8ac982d (changes whenever the content changes) Timeline: Created: 2026-11-13T03:07:37Z Last changed: 2026-11-13T03:07:37Z Last verified: 2026-11-20T12:30:33Z Next check: 2026-11-21T12:30:33Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of error handling approach | Return errors as structured data rather than throwing | [1] | 2026-11-20 error return format | isError: true | [1] | 2026-11-20 consequence of returning error | the agent sees it and can adjust its approach | [1] | 2026-11-20 consequence of throwing | it counts as a "mistake" and increments the consecutive mistake counter | [1] | 2026-11-20 Sources: [1] Cline. "Creating Custom Tools". https://docs.cline.bot/sdk/guides/creating-custom-tools.md Role: primary. Accessed: 2026-11-20T12:30:33Z Quote: "Return errors as structured data rather than throwing" (Supports: error handling approach) Quote: "isError: true" (Supports: error return format) Quote: "When a tool returns an error, the agent sees it and can adjust its approach." (Supports: consequence of returning error) Quote: "When a tool throws, it counts as a "mistake" and increments the consecutive mistake counter." (Supports: consequence of throwing) Published: 2026-11-20T06:00:25Z Snapshot SHA-256: 418501da04aad0100761f6e2826892ee1b3758bf9e0427cd9ec24ba1d1c8cbef (captured 2026-11-13T03:07:36Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-13T03:07:37Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:30:33Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:30:33Z Last attempt: 2026-11-20T12:30:33Z Notes and limitations: Extracted automatically from a single official source (section "Error Handling"). Related: https://latestn.com/tool/cline/agents-and-automation/define-tools-zod-schemas How do I define custom tools with Zod schemas in a Cline SDK agent? https://latestn.com/tool/cline/agents-and-automation/distribute-plugin-file-cli How do I distribute a Cline plugin as a file or install it via CLI? https://latestn.com/tool/cline/agents-and-automation/done-event-reasons What reasons can a Cline done event have? https://latestn.com/tool/cline/agents-and-automation/create-schedule How do I create a scheduled task in Cline Desktop? https://latestn.com/tool/cline/agents-and-automation/create-scheduled-agent-sdk How do I create a scheduled agent with the Cline SDK? https://latestn.com/tool/cline/agents-and-automation/cron-expression-reference What cron expression syntax does Cline scheduling support? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:07:37Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/cline/agents-and-automation/custom-tool-error-handling/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/cline/agents-and-automation/custom-tool-error-handling POST: https://latestn.com/dispute/tool/cline/agents-and-automation/custom-tool-error-handling with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/cline/agents-and-automation/custom-tool-error-handling?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I handle errors in a Cline custom tool's execute function? Revision 1, last verified 2026-11-20T12:30:33Z. https://latestn.com/tool/cline/agents-and-automation/custom-tool-error-handling (accessed 2026-11-21T10:07:31Z). @misc{LatestN_tool_cline_agents_and_automation_custom_tool_error_handling_r1, title = {How do I handle errors in a Cline custom tool's execute function?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/cline/agents-and-automation/custom-tool-error-handling}}, note = {Revision 1; digest sha256:4c38ad3ea8ac982d; last verified 2026-11-20T12:30:33Z; accessed 2026-11-21T10:07:31Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/cline/agents-and-automation/custom-tool-error-handling