{"record":{"id":"3aaa9556393748b9","repo":"deepseek-ai/deepseek-harness","slug":"image-type-mismatch","errorCode":"IMAGE_TYPE_MISMATCH","errorMessage":"Declared image type does not match its bytes.","messagePattern":"Declared image type does not match its bytes\\.","errorType":"exception","errorClass":"AttachmentError","httpStatus":null,"severity":"error","filePath":"packages/attachment/attachment-local/src/store.ts","lineNumber":56,"sourceCode":"\nfunction objectPath(root: string, sha256: string): string {\n  return join(root, 'objects', sha256.slice(0, 2), sha256)\n}\n\nfunction ensureReference(ref: ImageAttachmentRef): string {\n  const match = ID_PATTERN.exec(String(ref.attachmentId))\n  if (match?.[1] === undefined) throw new AttachmentError('Attachment reference is invalid.', 'INVALID_ATTACHMENT_REF')\n  return match[1]\n}\n\nasync function inspectMetadata(\n  data: Uint8Array,\n  declaredMediaType: ImageAttachmentRef['mediaType'],\n  limits: ImageAttachmentLimits,\n): Promise<DetectedImage> {\n  if (data.byteLength === 0) throw new AttachmentError('Image is empty.', 'INVALID_IMAGE')\n  const detected = await detectImage(data, { maxPixels: limits.maxImagePixels, maxDimension: limits.maxImageDimension })\n  if (detected.mediaType !== declaredMediaType) throw new AttachmentError('Declared image type does not match its bytes.', 'IMAGE_TYPE_MISMATCH')\n  return detected\n}\n\n/**\n * Run the full admission policy for one image without touching storage,\n * including normalization: a batch whose members all validate cannot later\n * be refused by the normalized image byte cap during publication.\n * @param input - encoded bytes and declared metadata.\n * @param limits - resolved source admission policy.\n * @param policy - resolved normalization policy.\n * @returns completion after the raster has been decoded and its normalized version proven to fit.\n */\nexport async function validateImageFile(\n  input: SaveImageAttachment,\n  limits: ImageAttachmentLimits,\n  policy: NormalizationPolicy,\n): Promise<void> {\n  await prepareImageFile(input, limits, policy)","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/attachment/attachment-local/src/store.ts#L38-L74","documentation":"Error \"Declared image type does not match its bytes.\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/attachment/attachment-local/src/store.ts:56 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Declare the actual media type of the bytes, or supply bytes that match the declared type."],"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"}