Using Tavily Search - Error "Failed to parse tool arguments from chat model response..."

Describe the problem/error/question

I’m building an agent that needs to search the web. To do that, I added the tool “Search in Tavily”. However, very frequently I get the error below, related to parsing arguments. It seems to be related with the query that the AI agent creates on the Tavily tool.

I tried to fix this by adding this to my system prompt:

"IMPORTANT
When searching the web using the tool “Search in Tavily”, make sure you always format your queries using the format below:
{ “query”: “What is LangChain?” }

Never add arrays or white spaces."

Sometimes it works, but very often it fails.

What is the error message (if any)?

Failed to parse tool arguments from chat model response. Text: “”. SyntaxError: Unexpected non-whitespace character after JSON at position 78 (line 1 column 79) Troubleshooting URL: OUTPUT_PARSING_FAILURE | 🦜️🔗 Langchain

Information on your n8n setup

  • n8n version: [email protected]
  • Database (default: SQLite): n/a
  • n8n EXECUTIONS_PROCESS setting (default: own, main): ?
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: MacOS 15.4.1

Hello @pedroklokner

Use the output parser to set the correct output format. Sending additional instructions won’t help here.

This issue has not been solved yet. Still facing this from time to time.

I’m also having this issue but without output parser.

For me it’s only happening with Anthropic / Sonnet LLMs under my OpenRouter credential. Are you in the same context?

cc @Jon @ihortom little help here

I’m facing the same problem, and I really hope we will figure it out.

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