{"record":{"id":"10aadb43275d91ee","repo":"n8n-io/n8n","slug":"unsupported-attachment-type-summary","errorCode":null,"errorMessage":"Unsupported attachment type: ${summary}","messagePattern":"Unsupported attachment type: (.+?)","errorType":"exception","errorClass":"UnsupportedAttachmentError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/src/parsers/validate-attachments.ts","lineNumber":87,"sourceCode":"\t\tconst summary = unsupported.map((u) => `${u.fileName} (${u.mimeType})`).join(', ');\n\t\tsuper(`Unsupported attachment type: ${summary}`);\n\t\tthis.name = 'UnsupportedAttachmentError';\n\t\tthis.unsupported = unsupported;\n\t\tthis.supported = getSupportedAttachmentMimeTypes();\n\t}\n}\n\n/**\n * Validates every attachment's MIME type. Throws `UnsupportedAttachmentError`\n * with details for every offending attachment if any are unsupported.\n */\nexport function validateAttachmentMimeTypes(attachments: AttachmentInfo[]): void {\n\tconst unsupported = attachments\n\t\t.filter((a) => !isSupportedAttachmentMimeType(a.mimeType))\n\t\t.map((a) => ({ fileName: a.fileName, mimeType: a.mimeType }));\n\n\tif (unsupported.length > 0) {\n\t\tthrow new UnsupportedAttachmentError(unsupported);\n\t}\n}\n","sourceCodeStart":69,"sourceCodeEnd":90,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/src/parsers/validate-attachments.ts#L69-L90","documentation":"Thrown by validateAttachmentMimeTypes as an UnsupportedAttachmentError (validate-attachments.ts:87). Unlike the plain Error throws in the parser, this is a dedicated error class carrying .unsupported (the offending files) and .supported (the full allow-list) so HTTP/SSE layers can surface a typed response. Supported types are PARSEABLE_MIME_TYPES plus image/*.","triggerScenarios":"Any attachment whose mimeType is not in PARSEABLE_MIME_TYPES and does not match an image/* wildcard. Validation runs over all attachments and collects every offender before throwing, so a single batch with two bad types lists both.","commonSituations":"Attaching a .doc (legacy Word) instead of .docx; an octet-stream mimeType with a generic filename; a video/audio file; a format the assistant cannot parse and that is not a vision image.","solutions":["Convert the file to a supported type (e.g. .doc -> .docx, .xls -> .xlsx).","Set the correct mimeType on AttachmentInfo (see getSupportedAttachmentMimeTypes()).","For images, ensure the mimeType starts with image/ so the wildcard match succeeds.","Drop the unsupported attachment from the batch."],"exampleFix":"// before: { fileName: 'report.doc', mimeType: 'application/msword', data }\n// after:  { fileName: 'report.docx', mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', data }","handlingStrategy":"try-catch","validationCode":"import { isSupportedAttachmentMimeType } from './validate-attachments';\nconst bad = attachments.filter(a => !isSupportedAttachmentMimeType(a.mimeType));\nif (bad.length) throw new Error(`Unsupported mime types: ${bad.map(a => a.mimeType).join(', ')}`);","typeGuard":"import { isSupportedAttachmentMimeType } from './validate-attachments';\nfunction isSupportedAttachment(a: { mimeType: string }): boolean {\n  return isSupportedAttachmentMimeType(a.mimeType);\n}","tryCatchPattern":"import { UnsupportedAttachmentError } from './validate-attachments';\ntry { validateAttachmentMimeTypes(attachments); }\ncatch (e) {\n  if (e instanceof UnsupportedAttachmentError) {\n    // e.unsupported lists offenders; e.supported lists allowed types; surface to user\n  }\n  throw e;\n}","preventionTips":["Filter attachments through isSupportedAttachmentMimeType before submission.","Convert legacy formats (.doc/.xls) to OOXML (.docx/.xlsx) at the source.","Set the correct mimeType on AttachmentInfo; do not rely on filename alone."],"tags":["mime-type","attachment-parsing","validation","typed-error"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}