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

Thrown by parseStructuredFile after base64 decoding (structured-file-parser.ts:379-380) when the decoded byte length exceeds MAX_DECODED_SIZE_BYTES (10 * 1024 * 1024). The limit applies to the decoded size, not the (smaller) base64 string length, so a ~7.5MB base64 payload can still trip it. The message is produced by formatSizeLimitMessage.

Source

Thrown at packages/@n8n/instance-ai/src/parsers/structured-file-parser.ts:380

}

// ── Main parse function ─────────────────────────────────────────────────────

export function parseStructuredFile(
	attachment: AttachmentInfo,
	attachmentIndex: number,
	input: ParseFileInput,
): ParseFileOutput {
	// Decode base64
	let decoded: Buffer;
	try {
		decoded = Buffer.from(attachment.data, 'base64');
	} catch {
		throw new Error('Failed to decode base64 attachment data');
	}

	if (decoded.length > MAX_DECODED_SIZE_BYTES) {
		throw new Error(formatSizeLimitMessage(decoded.length));
	}

	const content = decoded.toString('utf-8');
	const format = detectFormat(attachment.fileName, attachment.mimeType, input.format);
	if (!format || !isLegacyTabularFormat(format)) {
		throw new Error(
			`Unsupported format for "${attachment.fileName}" (${attachment.mimeType}). Supported: csv, tsv, json`,
		);
	}

	const hasHeader = input.hasHeader ?? true;
	const startRow = input.startRow ?? 0;
	const maxRows = Math.min(input.maxRows ?? DEFAULT_MAX_ROWS, MAX_ROWS_PER_CALL);
	const warnings: string[] = [];

	let columns: ColumnMeta[];
	let paginatedRows: Array<Record<string, CellValue>>;
	let totalRows: number;

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Reduce the attachment: filter rows, select fewer columns, or sample before attaching.
  2. If tabular, split into multiple attachments each under 10MB.
  3. Convert a large CSV to a more compact representation (drop unused columns) before upload.
  4. Confirm the file is not accidentally duplicated or includes headers/footers inflating size.

Example fix

// before: attach the full 14MB export
// after:  attach a filtered subset (e.g. last 1000 rows) under 10MB
Defensive patterns

Strategy: validation

Validate before calling

import { MAX_DECODED_SIZE_BYTES } from './structured-file-parser';
const decoded = Buffer.from(attachment.data, 'base64');
if (decoded.length > MAX_DECODED_SIZE_BYTES) {
  throw new Error(`Attachment too large: ${decoded.length} > ${MAX_DECODED_SIZE_BYTES}`);
}

Type guard

function isWithinSizeLimit(base64: string, limit = MAX_DECODED_SIZE_BYTES): boolean {
  // base64 length * 3/4 approximates decoded bytes (minus padding)
  return Math.floor(base64.length * 0.75) <= limit;
}

Try / catch

try { return parseStructuredFile(attachment, idx, input); }
catch (e) {
  if (e instanceof Error && e.message.startsWith('Attachment exceeds')) {
    // downsample, split, or trim columns then retry
  }
  throw e;
}

Prevention

When it happens

Trigger: Any CSV/TSV/JSON attachment whose decoded bytes > 10MB. Computed as decoded.length on the Buffer returned from Buffer.from(attachment.data,'base64').

Common situations: Large data exports; a user attaches a full database dump; a generated dataset exceeds the cap because rows were not pre-filtered; confusion between compressed/base64 size and decoded size.

Related errors


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