Skip to content

ValidationException: messages: text content blocks must be non-empty #1561

Open
@volkanunsal

Description

@volkanunsal

Bedrock Anthropic API is complaining because the client is sending an empty string to it:

   at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
cause:
  name: ValidationException
  $fault: client
  $metadata:
    requestId: ""
    extendedRequestId: ""
    cfId: ""
  message: "messages: text content blocks must be non-empty"
  stack: >-
    ValidationException: messages: text content blocks must be non-empty

Here is the last few log entries before the error:

genaiscript:anthropic:msg { type: 'content_block_stop', index: 1 } +0ms
genaiscript:anthropic message_delta +0ms
genaiscript:anthropic:msg {
genaiscript:anthropic:msg   type: 'message_delta',
genaiscript:anthropic:msg   delta: { stop_reason: 'tool_use', stop_sequence: null },
genaiscript:anthropic:msg   usage: { output_tokens: 553 }
genaiscript:anthropic:msg } +0ms
genaiscript:anthropic message_stop +0ms
genaiscript:anthropic:msg {
genaiscript:anthropic:msg   type: 'message_stop',
genaiscript:anthropic:msg   'amazon-bedrock-invocationMetrics': {
genaiscript:anthropic:msg     inputTokenCount: 2842,
genaiscript:anthropic:msg     outputTokenCount: 491,
genaiscript:anthropic:msg     invocationLatency: 12235,
genaiscript:anthropic:msg     firstByteLatency: 1118
genaiscript:anthropic:msg   }
genaiscript:anthropic:msg } +0ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions