n8n-io/n8n · error · Error

docx " " contains no extractable text.

Error message

docx "${attachment.fileName}" contains no extractable text.

What it means

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.

Solutions

  1. Confirm the document actually contains selectable text (not scanned images)
  2. If it is a scan, run OCR first and attach the text output
  3. Check that text is in the document body, not only in headers/footers or embedded objects
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/@n8n/instance-ai/src/parsers/docx-parser.ts:40 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/e581e3c0fb6bc002. Report an issue: GitHub.

Appendix: source

Thrown at packages/@n8n/instance-ai/src/parsers/docx-parser.ts:40

	assertOoxmlWithinBounds(decoded, attachment.fileName);

	const mammoth = await import('mammoth');
	const extractRawText = mammoth.extractRawText ?? mammoth.default?.extractRawText;
	if (typeof extractRawText !== 'function') {
		throw new Error('mammoth.extractRawText is not available');
	}

	let raw: { value: string };
	try {
		raw = await extractRawText({ buffer: decoded });
	} catch (error) {
		const message = error instanceof Error ? error.message : 'unknown error';
		throw new Error(`Failed to parse docx "${attachment.fileName}": ${message}`);
	}

	const text = raw.value?.trim() ?? '';
	if (!text) {
		throw new Error(`docx "${attachment.fileName}" contains no extractable text.`);
	}

	if (text.length > MAX_RESULT_CHARS) {
		return { text: text.slice(0, MAX_RESULT_CHARS), truncated: true };
	}
	return { text, truncated: false };
}

View on GitHub (pinned to 5ac6606e81)