-
Notifications
You must be signed in to change notification settings - Fork 646
Closed
Labels
bugThis issue is a bug.This issue is a bug.closed-for-stalenessp2This is a standard priority issueThis is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.service-apiThis issue is due to a problem in a service API, not the SDK implementation.This issue is due to a problem in a service API, not the SDK implementation.
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
Describe the bug
When using the Bedrock ConverseStream API, sending a toolResult field with a value that is a valid JSON type results in the error:
Bad Request - The format of the value at messages.3.content.0.toolResult.content.0.json is invalid. Provide a json object for the field and try again.
According to the API documentation and Smithy DocumentType spec, the toolResult field should accept any JSON-serializable value, not just objects.
Model used: claude-3-7-sonnet-20250219-v1
Regression Issue
- Select this option if this issue appears to be a regression.
SDK version number
@aws-sdk/client-bedrock-runtime": "^3.744.0"
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v22.17.1
Reproduction Steps
- Use HTTP client (I'm using axios) to make a direct HTTP request to the Bedrock ConverseStream API endpoint.
- In the request payload, set the
toolResult.contentfield to an array containing ajsonproperty with a non-object JSON value.
{
messages: [
{
role: "user",
content: [
{
toolResult: {
toolUseId: "some-id",
content: [
{ json: [] } // or { json: "foo" }, { json: 123 }, { json: true }, { json: null }
]
}
}
]
}
]
}
- Send the request to the Bedrock ConverseStream endpoint
- Observe that the API responds with the error
Provide a json object for the field and try again. - If you use an object for
json(e.g.,{json: { foo: "bar" } }) the request succeeds
Observed Behavior
When toolResult.content contains a json value that is not an object, the Bedrock ConverseStream API responds with an error message.
Bad Request - 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.`
Expected Behavior
Either the API is updated to accept all valid JSON values or the types are updated to clarify that only objects are accepted.
Possible Solution
No response
Additional Information/Context
No response
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.closed-for-stalenessp2This is a standard priority issueThis is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.service-apiThis issue is due to a problem in a service API, not the SDK implementation.This issue is due to a problem in a service API, not the SDK implementation.