{"record":{"id":"e581e3c0fb6bc002","repo":"n8n-io/n8n","slug":"docx-attachment-filename-contains-no-extracta","errorCode":null,"errorMessage":"docx \"${attachment.fileName}\" contains no extractable text.","messagePattern":"docx \"(.+?)\" contains no extractable text\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/src/parsers/docx-parser.ts","lineNumber":40,"sourceCode":"\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":22,"sourceCodeEnd":48,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/src/parsers/docx-parser.ts#L22-L48","documentation":"mammoth parsed the docx successfully but raw text extraction came back empty after trimming — the document has no extractable text content (e.g. it contains only images, is all blank pages, or text lives in unsupported constructs). Distinguishes 'parsed but empty' from 'failed to parse' so the caller can surface a content problem rather than a parse error.","triggerScenarios":"Thrown at packages/@n8n/instance-ai/src/parsers/docx-parser.ts:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the document actually contains selectable text (not scanned images)","If it is a scan, run OCR first and attach the text output","Check that text is in the document body, not only in headers/footers or embedded objects"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","contentChangedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}