{"record":{"id":"37ccf2493b146f71","repo":"n8n-io/n8n","slug":"attachment-exceeds-maximum-size-of-10-0-mb-got-37ccf2","errorCode":null,"errorMessage":"Attachment exceeds maximum size of 10.0 MB (got ${formatMB(actualBytes)})","messagePattern":"Attachment exceeds maximum size of 10\\.0 MB \\(got (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/src/parsers/structured-file-parser.ts","lineNumber":380,"sourceCode":"}\n\n// ── Main parse function ─────────────────────────────────────────────────────\n\nexport function parseStructuredFile(\n\tattachment: AttachmentInfo,\n\tattachmentIndex: number,\n\tinput: ParseFileInput,\n): ParseFileOutput {\n\t// Decode base64\n\tlet decoded: Buffer;\n\ttry {\n\t\tdecoded = Buffer.from(attachment.data, 'base64');\n\t} catch {\n\t\tthrow new Error('Failed to decode base64 attachment data');\n\t}\n\n\tif (decoded.length > MAX_DECODED_SIZE_BYTES) {\n\t\tthrow new Error(formatSizeLimitMessage(decoded.length));\n\t}\n\n\tconst content = decoded.toString('utf-8');\n\tconst format = detectFormat(attachment.fileName, attachment.mimeType, input.format);\n\tif (!format || !isLegacyTabularFormat(format)) {\n\t\tthrow new Error(\n\t\t\t`Unsupported format for \"${attachment.fileName}\" (${attachment.mimeType}). Supported: csv, tsv, json`,\n\t\t);\n\t}\n\n\tconst hasHeader = input.hasHeader ?? true;\n\tconst startRow = input.startRow ?? 0;\n\tconst maxRows = Math.min(input.maxRows ?? DEFAULT_MAX_ROWS, MAX_ROWS_PER_CALL);\n\tconst warnings: string[] = [];\n\n\tlet columns: ColumnMeta[];\n\tlet paginatedRows: Array<Record<string, CellValue>>;\n\tlet totalRows: number;","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/src/parsers/structured-file-parser.ts#L362-L398","documentation":"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.","triggerScenarios":"Any CSV/TSV/JSON attachment whose decoded bytes > 10MB. Computed as decoded.length on the Buffer returned from Buffer.from(attachment.data,'base64').","commonSituations":"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.","solutions":["Reduce the attachment: filter rows, select fewer columns, or sample before attaching.","If tabular, split into multiple attachments each under 10MB.","Convert a large CSV to a more compact representation (drop unused columns) before upload.","Confirm the file is not accidentally duplicated or includes headers/footers inflating size."],"exampleFix":"// before: attach the full 14MB export\n// after:  attach a filtered subset (e.g. last 1000 rows) under 10MB","handlingStrategy":"validation","validationCode":"import { MAX_DECODED_SIZE_BYTES } from './structured-file-parser';\nconst decoded = Buffer.from(attachment.data, 'base64');\nif (decoded.length > MAX_DECODED_SIZE_BYTES) {\n  throw new Error(`Attachment too large: ${decoded.length} > ${MAX_DECODED_SIZE_BYTES}`);\n}","typeGuard":"function isWithinSizeLimit(base64: string, limit = MAX_DECODED_SIZE_BYTES): boolean {\n  // base64 length * 3/4 approximates decoded bytes (minus padding)\n  return Math.floor(base64.length * 0.75) <= limit;\n}","tryCatchPattern":"try { return parseStructuredFile(attachment, idx, input); }\ncatch (e) {\n  if (e instanceof Error && e.message.startsWith('Attachment exceeds')) {\n    // downsample, split, or trim columns then retry\n  }\n  throw e;\n}","preventionTips":["Pre-decode and measure size before attaching.","Split large datasets into chunks under 10MB.","Filter rows and drop unused columns before export."],"tags":["size-limit","attachment-parsing","limits","memory"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}