Getting detailed error messages when AI Agent tools fail

Hello n8n Community,

I’m facing an issue when using Tools within the AI Agent node, specifically when one of the tools fails for a valid reason (e.g., an external API returns an expected error).

  • The Problem: When a Tool (which executes an HTTP request) fails within the AI Agent, the only output I receive in the Agent’s response is a generic error: "The service was not able to process your request".

  • The Comparison: If I run the exact same HTTP request outside of the AI Agent (e.g., directly in an HTTP Request node), the error response is much more detailed. I get the full JSON response from the external service, often including a specific “Full message” describing why the service failed.

  • The Need: I need to capture that detailed error information (the “Full message” or the full error body) when the Tool fails inside the AI Agent, as the reason for the failure is sometimes expected and needs to be handled or communicated to the user by the Agent.

My Questions:

  1. Is there a current way to access or retrieve the detailed error message/response body from a Tool that fails within an AI Agent?

  2. Alternatively, does anyone have suggestions for a different approach to structuring the workflow to ensure the AI Agent can receive and process these specific error descriptions?

Any help or insight would be greatly appreciated!

Information on your n8n setup

  • n8n version: 1.114.3
  • Running n8n via: Docker

Here when the ia tool fail:

Here i get the full message description (http request, no ia/tool):

Hi @Agustin_Pezzani

If you mean the “HTTP Request” tool, then you can enable the “Include Response Headers and Status” and “Never Error” options:

This will ensure that the tool prevents the agent from stopping, and the agent will be able to read useful information such as the statusCode, etc..

3 Likes
Thank you, that fixed my problem!

:flexed_biceps:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.