AI Agent node: Invalid 'messages[1].name': string too long. Expected a string with maximum length 64, but got a string with length 65 instead

Describe the problem/error/question

I don’t know where the error is coming from.

What is the error message (if any)?

Bad request - please check your parameters

Invalid ‘messages[1].name’: string too long. Expected a string with maximum length 64, but got a string with length 65 instead.

Please share your workflow

Workflow to filter conversation:

Information on your n8n setup

instance information
instance information

Debug info

core

  • n8nVersion: 1.81.4
  • platform: docker (self-hosted)
  • nodeJsVersion: 20.18.3
  • database: sqlite
  • executionMode: regular
  • concurrency: -1
  • license: enterprise (production)
  • consumerId: 985f8497-e4c0-40ab-ad35-e67078bf2255

storage

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: memory

pruning

  • enabled: true
  • maxAge: 336 hours
  • maxCount: 10000 executions

client

  • userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/134.0.0.0 safari/537.36
  • isTouchDevice: false

Generated at: 2025-03-14T15:33:23.365Z

Can you provide a screenshot of the error?
Maybe use a chat trigger so you can open that test window and see the AI steps.

1 Like

Edited: The issue was that I didn’t realize I was handling two types of messages: text and image. The problem occurred specifically with image messages because they have a different JSON structure. Instead of sending a string, the image type message sends an object.

Additionally, the JSON object included keys and values that exceeded OpenAI’s 64-character limit. (I couldn’t find this documented officially, but it seems to be a common issue based on others’ experiences I saw online.).

To fix this, I updated the workflow to properly separate the logic using an IF node, ensuring that a JSON object isn’t sent for image URLs, and to handle image messages correctly within n8n. I also cleared the stored object containing the URL from the Supabase vector database.

Just to clarify: the issue isn’t that OpenAI doesn’t accept URLs in the payload. It’s that the structure wasn’t what the model expected. Even sending a long string (thousands of characters) is fine, but sending an unexpected object structure causes problems.

After these changes, everything went back to normal.

Thanks for bringing it up, @solomon :smile:

2 Likes

Great! Please mark your reply as the solution, so we can close this topic

1 Like

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