Skip to content

converse returns error with enabled citations for text document #4726

@kovalzdw

Description

@kovalzdw

Describe the bug

When using Bedrock Converse API with attached txt file error is returned pointing to non-existent PDF file.

botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the Converse operation: The model returned the following errors: messages.0.content.1.image.source.bytes: The PDF specified was not valid.

Documentation says that citations should be available for document content.
https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_DocumentBlock.html

Moreover passing wrong extension in 'format' (eg. 'docx') error is returned stating that "Unsupported document format. Only txt and pdf formats are supported when citations are enabled ", meaning that txt should be fine.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Converse should respond properly with citations from document.

Current Behavior

botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the Converse operation: The model returned the following errors: messages.0.content.1.image.source.bytes: The PDF specified was not valid.

Reproduction Steps

`import boto3

client = boto3.client("bedrock-runtime")

request = {
"modelId": "eu.anthropic.claude-sonnet-4-5-20250929-v1:0",
"messages": [
{
"role": "user",
"content": [
{
"text": "What is attachemtn content?"
},
{
"document": {
"name": "test-file",
"format": "txt",
"source": {"bytes": b"The sky is blue, the grass is green."}
,
"citations": {
"enabled": True
}
}
}
]
}
],
"inferenceConfig": {
"maxTokens": 16000,
"temperature": 0.4
}
}

response = client.converse(**request)

print(response)`

Possible Solution

No response

Additional Information/Context

No response

SDK version used

boto3-1.42.55 botocore-1.42.55 s3transfer-0.16.0

Environment details (OS name and version, etc.)

Windows 11 Pro 25H2

Metadata

Metadata

Assignees

Labels

bedrockbugThis issue is a confirmed bug.p3This is a minor priority issueservice-apiThis issue is caused by the service API, not the SDK implementation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions