Problem with data processing by AI Agent node for specific text

Describe the problem/error/question

I processing newsletters data using n8n worklfow. recently encountered an issue where one of the newsletter processing started failing specifically at the AI Agent node. After multiple rounds of debugging I found that one of the newsletters has a text “lawsuit filed by activist Robby Starbuck”. Here specifically the name ‘Robby Starbuck’ is causing problem with AI Agent node. It gives the error “[ERROR: Cannot read properties of undefined (reading ‘message’)]”. With the AI agent I use Gemini model.

What is the error message (if any)?

[ERROR: Cannot read properties of undefined (reading ‘message’)]

Please share your workflow

Share the output returned by the last node

Google is moving to dismiss a $15 million defamation lawsuit who claims its AI chatbot falsely linked him to sexual assault allegations and white nationalism. Unlike Meta, which recently settled a similar suit and even hired Starbucks as an advisor, Google argues the outputs resulted from “misuse of developer tools” and aren’t grounds for legal liability.

Information on your n8n setup

  • n8n version: 1.113.3
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Using latest n8n image with podman
  • Operating system: MacOS

This error typically occurs when the AI Agent node receives an unexpected response structure from the Gemini model, possibly due to content filtering or API response issues with specific text patterns.

Here are a few things to try:

• **Add error handling**: Wrap your AI Agent node in a try-catch using the “Continue on Fail” option in the node settings

• **Test with sanitized input**: Try replacing “Robby Starbuck” with a generic name to confirm it’s the specific text causing the issue

• **Check Gemini’s content policies**: The name might be triggering content filtering - try using a different model temporarily to isolate the issue

• **Add logging**: Insert a Set node before the AI Agent to log the exact input being sent, which can help identify if there are any formatting issues

If the problem persists, consider preprocessing the text to replace problematic names with placeholders before sending to the AI Agent, then replacing them back in the output.

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