deepseek-ai/deepseek-harness · error · AttachmentError

ATTACHMENT_WRITE_FAILED

ATTACHMENT_WRITE_FAILED

Error message

Encoded model-request image does not match its verified 8-bit sRGB metadata.

What it means

Error "Encoded model-request image does not match its verified 8-bit sRGB metadata." thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/attachment/attachment-local/src/request-image.ts:221

      || detected.width > maximum.width || detected.height > maximum.height
      || !encodedAlphaIsCompatible(expectedAlpha, detected)) return undefined
    return { data, mediaType: detected.mediaType, width: detected.width, height: detected.height, hasAlpha: detected.hasAlpha }
  } catch (error: unknown) {
    if ((error as NodeJS.ErrnoException | null)?.code === 'ENOENT') return undefined
    signal?.throwIfAborted()
    return undefined
  }
}

async function verifyRequestImage(
  image: EncodedRequestImage,
  expectedAlpha: boolean,
): Promise<VerifiedRequestImage> {
  const detected = await detectImage(image.data)
  if (detected.depth !== 'uchar' || detected.space !== 'srgb'
    || detected.width !== image.width || detected.height !== image.height
    || detected.mediaType !== image.mediaType || !encodedAlphaIsCompatible(expectedAlpha, detected)) {
    throw new AttachmentError(
      'Encoded model-request image does not match its verified 8-bit sRGB metadata.',
      'ATTACHMENT_WRITE_FAILED',
    )
  }
  return { ...image, hasAlpha: detected.hasAlpha }
}

async function writeCached(path: string, data: Uint8Array): Promise<void> {
  await mkdir(dirname(path), { recursive: true, mode: 0o700 })
  const temporary = `${path}.${randomUUID()}.tmp`
  try {
    await writeFile(temporary, data, { mode: 0o600, flag: 'wx' })
    await rename(temporary, path)
  } finally {
    await rm(temporary, { force: true })
  }
}

View on GitHub (pinned to b150a551b8)

Solutions

  1. Re-encode the image as 8-bit sRGB so the bytes match their verified metadata.

When it happens

Trigger: Thrown at packages/attachment/attachment-local/src/request-image.ts:221 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/192e23a329067888. Report an issue: GitHub.