n8n-io/n8n · error

Attachment exceeds maximum size of 10.0 MB (got ${formatMB(a

Error message

Attachment exceeds maximum size of 10.0 MB (got ${formatMB(actualBytes)})

What it means

Error "Attachment exceeds maximum size of 10.0 MB (got ${formatMB(actualBytes)})" thrown in n8n-io/n8n.

Source

Thrown at packages/@n8n/instance-ai/src/parsers/pdf-parser.ts:22

	formatSizeLimitMessage,
	type AttachmentInfo,
} from './structured-file-parser';

export interface PdfExtractionResult {
	text: string;
	pages: number;
	truncated: boolean;
}

/**
 * Extracts plain text from a PDF attachment using `pdf-parse`.
 *
 * Lazy-imported so the module is only loaded the first time a PDF is parsed.
 */
export async function extractPdfText(attachment: AttachmentInfo): Promise<PdfExtractionResult> {
	const decoded = Buffer.from(attachment.data, 'base64');
	if (decoded.length > MAX_DECODED_SIZE_BYTES) {
		throw new Error(formatSizeLimitMessage(decoded.length));
	}

	// pdf-parse v2 is backed by pdfjs-dist, which expects a `DOMMatrix` global
	// that Node.js does not provide. Polyfill it before parsing.
	if (typeof Reflect.get(globalThis, 'DOMMatrix') === 'undefined') {
		const { default: DOMMatrix } = await import('@thednp/dommatrix');
		Reflect.set(globalThis, 'DOMMatrix', DOMMatrix);
	}

	const { PDFParse } = await import('pdf-parse');

	const parser = new PDFParse({ data: decoded });
	let extractedText: string;
	let totalPages: number;
	try {
		const result = await parser.getText();
		extractedText = result.text;
		totalPages = result.total;

View on GitHub (pinned to 5ac6606e81)

When it happens

Trigger: Thrown at packages/@n8n/instance-ai/src/parsers/pdf-parser.ts:22 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/d3595405306ab98c. Report an issue: GitHub.