{"record":{"id":"d2f0b67f6c8d53e1","repo":"deepseek-ai/deepseek-harness","slug":"image-dimension-too-large","errorCode":"IMAGE_DIMENSION_TOO_LARGE","errorMessage":"Image exceeds the configured per-side pixel limit.","messagePattern":"Image exceeds the configured per-side pixel limit\\.","errorType":"exception","errorClass":"AttachmentError","httpStatus":null,"severity":"error","filePath":"packages/attachment/attachment-local/src/image.ts","lineNumber":122,"sourceCode":"  /** Per-side admission limit applied to width and height independently. */\n  maxDimension?: number\n}\n\n/**\n * Fully decode a supported raster and return its intrinsic metadata.\n * @param data - complete encoded image bytes.\n * @param limits - intrinsic-dimension admission limits.\n * @returns verified format and dimensions.\n */\nexport async function detectImage(data: Uint8Array, limits?: DecodedImageLimits): Promise<DetectedImage> {\n  try {\n    const image = sharp(data, { failOn: 'error', limitInputPixels: false })\n    const detected = await imageMetadata(image)\n    if (limits?.maxPixels !== undefined && detected.width * detected.height > limits.maxPixels) {\n      throw new AttachmentError('Image exceeds the configured decoded-pixel limit.', 'IMAGE_TOO_MANY_PIXELS')\n    }\n    if (limits?.maxDimension !== undefined && Math.max(detected.width, detected.height) > limits.maxDimension) {\n      throw new AttachmentError('Image exceeds the configured per-side pixel limit.', 'IMAGE_DIMENSION_TOO_LARGE')\n    }\n    await image.raw().toBuffer()\n    return detected\n  } catch (error) {\n    if (error instanceof AttachmentError) throw error\n    throw new AttachmentError('Unsupported or malformed image data.', 'INVALID_IMAGE', { cause: error })\n  }\n}\n","sourceCodeStart":104,"sourceCodeEnd":131,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/attachment/attachment-local/src/image.ts#L104-L131","documentation":"Admission limit: after header parsing, detectImage refuses the image with IMAGE_DIMENSION_TOO_LARGE when either intrinsic side (perceived, EXIF-oriented) exceeds limits.maxDimension — the store default is 8192 (maxImageDimension). The cap applies to width and height independently; like the pixel cap it refuses rather than shrinks, since normalization runs only for admitted images.","triggerScenarios":"Submitting an image whose width or height exceeds maxDimension — tall full-page screenshots, skinny panoramas such as 1000x12000, rotated photos reporting a long side over 8192 — through saveImage/validateImage or detectImage with limits.","commonSituations":"Full-page web-capture screenshots with long scroll heights; banner strips; deployments that lowered maxImageDimension; ultra-tall mobile captures.","solutions":["Downscale the long edge to the cap before submitting (fit: 'inside', withoutEnlargement: true keeps the aspect ratio).","Raise maxImageDimension in the attachment-local config when long screenshots are expected workload.","Check both caps: an image can pass the per-side test and still exceed the decoded-pixel product cap."],"exampleFix":"// before\nawait store.saveImage({ data: tallScreenshot, mediaType: 'image/png' })\n\n// after\nconst data = await sharp(tallScreenshot)\n  .resize({ width: 8192, height: 8192, fit: 'inside', withoutEnlargement: true })\n  .png().toBuffer()\nawait store.saveImage({ data, mediaType: 'image/png' })","handlingStrategy":"validation","validationCode":"const { width, height } = await probeImage(bytes)\nconst cap = store.imageLimits.maxDimension\nif (Math.max(width, height) > cap) {\n  throw new Error(`long edge ${Math.max(width, height)}px exceeds ${cap}px`)\n}","typeGuard":"import { isImageAdmissionError } from '@deepseek-ai/dsh-attachment'\nconst isDimensionTooLarge = (e: unknown): boolean =>\n  isImageAdmissionError(e) && e.code === 'IMAGE_DIMENSION_TOO_LARGE'","tryCatchPattern":"try {\n  await store.saveImage(input)\n} catch (error) {\n  if (isImageAdmissionError(error) && error.code === 'IMAGE_DIMENSION_TOO_LARGE') {\n    // reject or shrink the long edge client-side; not a transient failure\n  }\n  throw error\n}","preventionTips":["Enforce a long-edge cap in the client capture or export path.","Expose maxDimension alongside maxPixels in upload UI hints.","The cap applies to each side independently, not to the sum of width and height."],"tags":["image","limits","dimension","admission","attachment"],"backgroundTag":"image-size-limit-exceeded","analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}