N8n ai agent Invalid 'text.format.name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_-]+$'

Describe the problem/error/question

AI Agent throwing unexpected error

What is the error message (if any)?

n8n ai agent Invalid ‘text.format.name’: string does not match pattern. Expected a string that matches the pattern ‘[1]+$’.

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

  1. a-zA-Z0-9_- ↩︎

If you are forcing a json schema, make sure you do not accidentally put a space anywhere in the schema.

I had a trailing space that I did not catch.

The fix was to remove any space characters from the schema name in the openai output model for the AI-Agent Node

1 Like

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