deepseek-ai/deepseek-harness · error · LlmError

UNSUPPORTED_CONTENT

UNSUPPORTED_CONTENT

Error message

pi-ai cannot represent an image in an in-history ${message.role} message

What it means

Error "pi-ai cannot represent an image in an in-history ${message.role} message" thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/llm/llm-pi-ai/src/context.ts:40

  return message.content
    .filter(block => block.type === 'text')
    .map(block => block.text)
    .join('')
}


/** Flatten text recursively inside one tool result. */
function toolResultText(blocks: readonly ContentBlock[]): string {
  return blocks.map(block => block.type === 'text'
    ? block.text
    : block.type === 'tool-result' ? toolResultText(block.content) : '').join('')
}

/** Reject image roles that pi-ai cannot replay before request-size offloading can replace them. */
function assertSupportedImageRoles(messages: readonly Message[]): void {
  for (const message of messages) {
    if (message.role !== 'user' && contentHasImage(message.content)) {
      throw new LlmError(
        `pi-ai cannot represent an image in an in-history ${message.role} message`,
        'UNSUPPORTED_CONTENT',
      )
    }
  }
}

async function userContent(
  blocks: readonly ContentBlock[],
  requestImages: ReadonlyMap<AttachmentId, RequestImageAttachment>,
): Promise<string | (TextContent | ImageContent)[]> {
  const content: (TextContent | ImageContent)[] = []
  for (const block of blocks) {
    switch (block.type) {
      case 'text':
        if (block.text.length > 0) content.push({ type: 'text', text: block.text })
        break
      case 'image': {

View on GitHub (pinned to b150a551b8)

Solutions

  1. Remove the image from the in-history message, or use a protocol that can represent images in that role.

When it happens

Trigger: Thrown at packages/llm/llm-pi-ai/src/context.ts:40 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/99d4b2bd797243d9. Report an issue: GitHub.