{"record":{"id":"d326abf3dc363f85","repo":"deepseek-ai/deepseek-harness","slug":"attachment-read-failed","errorCode":"ATTACHMENT_READ_FAILED","errorMessage":"Unable to read image attachment.","messagePattern":"Unable to read image attachment\\.","errorType":"exception","errorClass":"AttachmentError","httpStatus":null,"severity":"error","filePath":"packages/attachment/attachment-local/src/store.ts","lineNumber":282,"sourceCode":" * @param ref - reference recorded in the session log.\n * @param signal - optional cancellation for filesystem and verification work.\n * @returns verified bytes and reference.\n * @throws the signal reason when aborted, or an AttachmentError when verification fails.\n */\nexport async function readImageFile(\n  root: string,\n  ref: ImageAttachmentRef,\n  signal?: AbortSignal,\n): Promise<StoredImageAttachment> {\n  signal?.throwIfAborted()\n  const sha256 = ensureReference(ref)\n  let data: Uint8Array\n  try {\n    data = new Uint8Array(await readFile(objectPath(root, sha256), { signal }))\n  } catch (error) {\n    signal?.throwIfAborted()\n    if (error instanceof Error && 'code' in error && error.code === 'ENOENT') throw new AttachmentError('Attachment object is missing.', 'ATTACHMENT_NOT_FOUND')\n    throw new AttachmentError('Unable to read image attachment.', 'ATTACHMENT_READ_FAILED', { cause: error })\n  }\n  signal?.throwIfAborted()\n  if (digest(data) !== sha256) throw new AttachmentError('Stored attachment failed integrity verification.', 'ATTACHMENT_CORRUPT')\n  // The digest proves these are the exact bytes admission fully decoded, so\n  // the read path only re-derives the header fields (no raster decode, no\n  // per-request pixel amplification on history replay).\n  const metadata = await probeImage(data)\n  signal?.throwIfAborted()\n  if (metadata.mediaType !== ref.mediaType || data.byteLength !== ref.bytes\n    || metadata.width !== ref.width || metadata.height !== ref.height) {\n    throw new AttachmentError('Stored attachment metadata does not match its reference.', 'ATTACHMENT_CORRUPT')\n  }\n  return { ref, data }\n}\n","sourceCodeStart":264,"sourceCodeEnd":297,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/attachment/attachment-local/src/store.ts#L264-L297","documentation":"Error \"Unable to read image attachment.\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/attachment/attachment-local/src/store.ts:282 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the store read path and permissions, then retry reading the attachment."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}