{"record":{"id":"815924898e397554","repo":"n8n-io/n8n","slug":"failed-to-parse-docx-attachment-filename-m","errorCode":null,"errorMessage":"Failed to parse docx \"${attachment.fileName}\": ${message}","messagePattern":"Failed to parse docx \"(.+?)\": (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/src/parsers/docx-parser.ts","lineNumber":35,"sourceCode":"export 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() ?? '';\n\tif (!text) {\n\t\tthrow new Error(`docx \"${attachment.fileName}\" contains no extractable text.`);\n\t}\n\n\tif (text.length > MAX_RESULT_CHARS) {\n\t\treturn { text: text.slice(0, MAX_RESULT_CHARS), truncated: true };\n\t}\n\treturn { text, truncated: false };\n}\n","sourceCodeStart":17,"sourceCodeEnd":48,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/src/parsers/docx-parser.ts#L17-L48","documentation":"Error \"Failed to parse docx \"${attachment.fileName}\": ${message}\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/instance-ai/src/parsers/docx-parser.ts:35 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"}