{"record":{"id":"a316dc58dfed3530","repo":"deepseek-ai/deepseek-harness","slug":"image-too-large-a316dc","errorCode":"IMAGE_TOO_LARGE","errorMessage":"Image cannot be encoded within the model-request byte budget.","messagePattern":"Image cannot be encoded within the model-request byte budget\\.","errorType":"exception","errorClass":"AttachmentError","httpStatus":null,"severity":"error","filePath":"packages/attachment/attachment-local/src/request-image.ts","lineNumber":184,"sourceCode":"      width: attachment.ref.width,\n      height: attachment.ref.height,\n    }\n  }\n  const lowColour = await hasLowColourCount(sourcePipeline(attachment))\n  for (;;) {\n    const encodedVersion = await encodeFirstWithinLimit(\n      encodingAttempts(attachment, dimensions.width, dimensions.height, hasAlpha, lowColour),\n      policy.maxBytes,\n    )\n    if (!isExhaustedEncoding(encodedVersion)) return encodedVersion\n    if (dimensions.width === 1 && dimensions.height === 1) break\n    const scale = Math.min(0.9, Math.sqrt(policy.maxBytes / encodedVersion.smallest.data.byteLength) * 0.95)\n    dimensions = {\n      width: Math.max(1, Math.floor(dimensions.width * scale)),\n      height: Math.max(1, Math.floor(dimensions.height * scale)),\n    }\n  }\n  throw new AttachmentError('Image cannot be encoded within the model-request byte budget.', 'IMAGE_TOO_LARGE')\n}\n\nfunction cachePath(root: string, hash: string): string {\n  return join(root, 'request-images', hash.slice(0, 2), hash)\n}\n\nasync function readCached(\n  path: string,\n  attachment: StoredImageAttachment,\n  policy: ImageRequestPolicy,\n  expectedAlpha: boolean,\n  signal?: AbortSignal,\n): Promise<VerifiedRequestImage | undefined> {\n  try {\n    const data = new Uint8Array(await readFile(path, { signal }))\n    const detected = await probeImage(data)\n    const maximum = requestImageDimensions(attachment.ref.width, attachment.ref.height, policy.maxPixels)\n    if (data.byteLength > policy.maxBytes || detected.depth !== 'uchar' || detected.space !== 'srgb'","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/attachment/attachment-local/src/request-image.ts#L166-L202","documentation":"Error \"Image cannot be encoded within the model-request byte budget.\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/attachment/attachment-local/src/request-image.ts:184 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce image size or count so the encoded images fit the model-request byte budget."],"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"}