{"record":{"id":"d3595405306ab98c","repo":"n8n-io/n8n","slug":"attachment-exceeds-maximum-size-of-10-0-mb-got","errorCode":null,"errorMessage":"Attachment exceeds maximum size of 10.0 MB (got ${formatMB(actualBytes)})","messagePattern":"Attachment exceeds maximum size of 10\\.0 MB \\(got (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/src/parsers/pdf-parser.ts","lineNumber":22,"sourceCode":"\tformatSizeLimitMessage,\n\ttype AttachmentInfo,\n} from './structured-file-parser';\n\nexport interface PdfExtractionResult {\n\ttext: string;\n\tpages: number;\n\ttruncated: boolean;\n}\n\n/**\n * Extracts plain text from a PDF attachment using `pdf-parse`.\n *\n * Lazy-imported so the module is only loaded the first time a PDF is parsed.\n */\nexport async function extractPdfText(attachment: AttachmentInfo): Promise<PdfExtractionResult> {\n\tconst decoded = Buffer.from(attachment.data, 'base64');\n\tif (decoded.length > MAX_DECODED_SIZE_BYTES) {\n\t\tthrow new Error(formatSizeLimitMessage(decoded.length));\n\t}\n\n\t// pdf-parse v2 is backed by pdfjs-dist, which expects a `DOMMatrix` global\n\t// that Node.js does not provide. Polyfill it before parsing.\n\tif (typeof Reflect.get(globalThis, 'DOMMatrix') === 'undefined') {\n\t\tconst { default: DOMMatrix } = await import('@thednp/dommatrix');\n\t\tReflect.set(globalThis, 'DOMMatrix', DOMMatrix);\n\t}\n\n\tconst { PDFParse } = await import('pdf-parse');\n\n\tconst parser = new PDFParse({ data: decoded });\n\tlet extractedText: string;\n\tlet totalPages: number;\n\ttry {\n\t\tconst result = await parser.getText();\n\t\textractedText = result.text;\n\t\ttotalPages = result.total;","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/src/parsers/pdf-parser.ts#L4-L40","documentation":"Error \"Attachment exceeds maximum size of 10.0 MB (got ${formatMB(actualBytes)})\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/instance-ai/src/parsers/pdf-parser.ts:22 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}