{"record":{"id":"523b82e4a452fa22","repo":"deepseek-ai/deepseek-harness","slug":"invalid-image-base64","errorCode":"INVALID_IMAGE_BASE64","errorMessage":"Image upload is not canonical base64.","messagePattern":"Image upload is not canonical base64\\.","errorType":"exception","errorClass":"AttachmentError","httpStatus":null,"severity":"error","filePath":"packages/attachment/attachment/src/admission.ts","lineNumber":12,"sourceCode":"/** Wire-form admission of base64-encoded image uploads. @module @deepseek-ai/dsh-attachment/admission */\n\nimport { Buffer } from 'node:buffer'\nimport { AttachmentError } from './error.ts'\nimport type { AttachmentStore } from './index.ts'\nimport type { EncodedImageAttachment, ImageAttachmentRef, SaveImageAttachment } from './types.ts'\n\n/** Decode one upload payload while rejecting non-canonical base64 forms. */\nfunction decodeBase64(data: string): Uint8Array {\n  const decoded = Buffer.from(data, 'base64')\n  if (data.length === 0 || decoded.toString('base64') !== data) {\n    throw new AttachmentError('Image upload is not canonical base64.', 'INVALID_IMAGE_BASE64')\n  }\n  return new Uint8Array(decoded)\n}\n\n/** Store input for one decoded upload. */\nfunction saveInput(image: EncodedImageAttachment): SaveImageAttachment {\n  return {\n    data: decodeBase64(image.data),\n    mediaType: image.mediaType,\n    ...image.name === undefined ? {} : { name: image.name },\n  }\n}\n\n/**\n * Admit one wire image batch: enforce canonical base64 on every member, then\n * delegate batch admission — count and aggregate-byte limits, media-type and\n * per-image validation, ordered commit — to {@link AttachmentStore.saveImages}.\n * The shared entry for every RPC endpoint accepting browser uploads.","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/attachment/attachment/src/admission.ts#L1-L30","documentation":"Error \"Image upload is not canonical base64.\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/attachment/attachment/src/admission.ts:12 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Encode the upload with canonical base64 without whitespace or URL-safe characters."],"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"}