deepseek-ai/deepseek-harness · error · AttachmentError

INVALID_IMAGE_BASE64

INVALID_IMAGE_BASE64

Error message

Image upload is not canonical base64.

What it means

Error "Image upload is not canonical base64." thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/attachment/attachment/src/admission.ts:12

/** Wire-form admission of base64-encoded image uploads. @module @deepseek-ai/dsh-attachment/admission */

import { Buffer } from 'node:buffer'
import { AttachmentError } from './error.ts'
import type { AttachmentStore } from './index.ts'
import type { EncodedImageAttachment, ImageAttachmentRef, SaveImageAttachment } from './types.ts'

/** Decode one upload payload while rejecting non-canonical base64 forms. */
function decodeBase64(data: string): Uint8Array {
  const decoded = Buffer.from(data, 'base64')
  if (data.length === 0 || decoded.toString('base64') !== data) {
    throw new AttachmentError('Image upload is not canonical base64.', 'INVALID_IMAGE_BASE64')
  }
  return new Uint8Array(decoded)
}

/** Store input for one decoded upload. */
function saveInput(image: EncodedImageAttachment): SaveImageAttachment {
  return {
    data: decodeBase64(image.data),
    mediaType: image.mediaType,
    ...image.name === undefined ? {} : { name: image.name },
  }
}

/**
 * Admit one wire image batch: enforce canonical base64 on every member, then
 * delegate batch admission — count and aggregate-byte limits, media-type and
 * per-image validation, ordered commit — to {@link AttachmentStore.saveImages}.
 * The shared entry for every RPC endpoint accepting browser uploads.

View on GitHub (pinned to b150a551b8)

Solutions

  1. Encode the upload with canonical base64 without whitespace or URL-safe characters.

When it happens

Trigger: Thrown at packages/attachment/attachment/src/admission.ts:12 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/523b82e4a452fa22. Report an issue: GitHub.