{"record":{"id":"28c7c176b57e45dc","repo":"n8n-io/n8n","slug":"attachment-exceeds-maximum-size-of-formatmb-max","errorCode":null,"errorMessage":"Attachment exceeds maximum size of ${formatMB(MAX_DECODED_SIZE_BYTES)} (got ${formatMB(actualBytes)})","messagePattern":"Attachment exceeds maximum size of (.+?) \\(got (.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/src/parsers/docx-parser.ts","lineNumber":20,"sourceCode":"import {\n\tMAX_DECODED_SIZE_BYTES,\n\tMAX_RESULT_CHARS,\n\tformatSizeLimitMessage,\n\ttype AttachmentInfo,\n} from './structured-file-parser';\n\nexport interface DocxExtractionResult {\n\ttext: string;\n\ttruncated: boolean;\n}\n\n/**\n * Extracts plain text from a `.docx` (Office Open XML) attachment using `mammoth`.\n */\nexport async function extractDocxText(attachment: AttachmentInfo): Promise<DocxExtractionResult> {\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\tassertOoxmlWithinBounds(decoded, attachment.fileName);\n\n\tconst mammoth = await import('mammoth');\n\tconst extractRawText = mammoth.extractRawText ?? mammoth.default?.extractRawText;\n\tif (typeof extractRawText !== 'function') {\n\t\tthrow new Error('mammoth.extractRawText is not available');\n\t}\n\n\tlet raw: { value: string };\n\ttry {\n\t\traw = await extractRawText({ buffer: decoded });\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : 'unknown error';\n\t\tthrow new Error(`Failed to parse docx \"${attachment.fileName}\": ${message}`);\n\t}\n\n\tconst text = raw.value?.trim() ?? '';","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/src/parsers/docx-parser.ts#L2-L38","documentation":"Error \"Attachment exceeds maximum size of ${formatMB(MAX_DECODED_SIZE_BYTES)} (got ${formatMB(actualBytes)})\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/instance-ai/src/parsers/docx-parser.ts:20 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-13T14:17:21.547Z"}