{"record":{"id":"367b1fb4a6de402e","repo":"deepseek-ai/deepseek-harness","slug":"the-declared-media-type-is-not-png-jpeg-webp-or","errorCode":null,"errorMessage":"the declared media type is not PNG, JPEG, WebP, or GIF","messagePattern":"the declared media type is not PNG, JPEG, WebP, or GIF","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/mcp/mcp-client/src/tools.ts","lineNumber":381,"sourceCode":"/** Whether an untrusted MCP content array contains a declared image block. */\nfunction containsImage(content: JsonValue[]): boolean {\n  return content.some(value => isRecord(value) && value.type === 'image')\n}\n\n/** Narrow one JSON value to a string-keyed object. */\nfunction isRecord(value: JsonValue): value is { [key: string]: JsonValue } {\n  return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/** Narrow a declared MIME string to the durable image vocabulary. */\nfunction isImageMediaType(value: string): value is ImageMediaType {\n  return IMAGE_MEDIA_TYPES.includes(value as ImageMediaType)\n}\n\n/** Decode one untrusted MCP image block without accepting base64 aliases. */\nfunction decodeImage(block: McpContentBlock): SaveImageAttachment {\n  if (block.mimeType === undefined || !isImageMediaType(block.mimeType)) {\n    throw new Error('the declared media type is not PNG, JPEG, WebP, or GIF')\n  }\n  if (block.data === undefined || !CANONICAL_BASE64.test(block.data)) {\n    throw new Error('the image data is not canonical base64')\n  }\n  const data = Buffer.from(block.data, 'base64')\n  if (data.toString('base64') !== block.data) {\n    throw new Error('the image data is not canonical base64')\n  }\n  return { data, mediaType: block.mimeType }\n}\n\n/**\n * Resolve the active model route and durable store for an image-bearing result.\n * @param ctx - plugin context with optional services.\n * @param exec - exact tool execution whose agent supplies the latest route.\n * @returns the attachment store after exact positive image-capability proof.\n */\nasync function resolveImageAdmission(ctx: Context, exec: ToolExecution): Promise<AttachmentStore> {","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/mcp/mcp-client/src/tools.ts#L363-L399","documentation":"Error \"the declared media type is not PNG, JPEG, WebP, or GIF\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/mcp/mcp-client/src/tools.ts:381 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Convert the image to PNG, JPEG, WebP, or GIF and fix the declared media 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"}