JSON format error using AWS Bedrock Chat Model

I’m trying to build a chatbot for customer support with basic knowledge about my app. These are the steps that we already took (All inside AWS).

  • Aurora instance created with the database, schema, table and indexes necessary to be populated.
  • AWS Bedrock KBD created with a source data based on S3.
  • S3 bucket filled with .md and .txt files with all the information.
  • The KBD was populated using Titan Text Embeddings V2 and vectors of 1024 dims.

Inside n8n I create a simple AI Agent using Nova Pro as the chat model. The problem I’m facing is that the JSON returned from the embedding has an invalid JSON Format:

The format of the value at messages.2.content.0.toolResult.content.0.json is invalid. Provide a json object for the field and try again

This is my flow and a photo with the returned JSON to better understanding.

Is there something that is missing in the flow, maybe a parser or something like that?

Debug info

core

  • n8nVersion: 1.85.4
  • platform: docker (cloud)
  • nodeJsVersion: 20.18.3
  • database: sqlite
  • executionMode: regular
  • concurrency: 5
  • license: community
  • consumerId: 00000000-0000-0000-0000-000000000000

storage

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

pruning

  • enabled: true
  • maxAge: 168 hours
  • maxCount: 2500 executions

client

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

Generated at: 2025-04-16T15:53:13.478Z

2 Likes

After shifted to OpenAI, no issue coming but it is related to AWS beadrock only.

anyone got to any workarounds to get this working with bedrock?
OpenAI works fine for me too. I had a similar error on the AI Agent node with Bedrock on the regular prompts (non-rag use case), and by adding a set node to create a Human and System fields to ensure they are not empty, that one is working now (it was complaining from Human field being empty). Can’t figure out what exactly needs to be formatted to find a workaround here…

The issue is still present.

The issue is still present.

I can also confirm this issue is happening on Bedrock.