
anthropic
#10487
input_validation_error
Input error: text content blocks must not be empty.
This error has been identified and solved.
Reason
The HTTP 400 Bad Request error with the message "messages: text content blocks must be non-empty" from the Anthropic API indicates that the request you are sending contains empty or missing text content in the message blocks. This error occurs because the API requires that each message or text content block included in the request must have some non-empty text content to process the request correctly.
Solution
To fix the HTTP 400 Bad Request error with the message "messages: text content blocks must be non-empty" from the Anthropic API, you need to ensure that all message blocks in your request contain non-empty text content.
Here are the key steps to resolve this issue:
Verify that each message block has a
content
field.Ensure the
content
field is not empty.Remove any empty or null text content blocks from the request.
Double-check the request payload for any formatting errors that might lead to empty content blocks.
Suggested Links
https://github.com/continuedev/continue/issues/2006
https://community.openai.com/t/content-is-required-property-error-400/486260
https://www.restack.io/p/anthropic-answer-http-400-bad-request-cat-ai
https://docs.anthropic.com/en/api/errors
https://forum.cursor.com/t/unable-to-reach-anthropic/22766
https://github.com/langchain-ai/langchain/issues/18646
https://www.googlecloudcommunity.com/gc/AI-ML/Not-able-to-use-anthropic-claude-3-5-model-API/m-p/830352