n8n-io/n8n · error · Error

Unknown encoding

Error message

Unknown encoding ${encoding}

What it means

PartData.fromData dispatches on the MIME encoding token and handles QUOTED-PRINTABLE, 7BIT, 8BIT/BINARY, BASE64 and UUENCODE; anything else reaches the final else and throws. The message echoes the unrecognized encoding token from the email part's Content-Transfer-Encoding header — the guard means 'this decoder set doesn't implement that encoding', typically from a malformed or exotic header.

Solutions

  1. Inspect the raw part's Content-Transfer-Encoding header for damage or non-standard tokens (case/whitespace variants)
  2. Treat the part as plain text or base64 manually if the body is known to be one of those
  3. File an issue to add support for the encoding if it is a legitimate standard one
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/@n8n/imap/src/part-data.ts:36 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/3ab498682ff8f018. Report an issue: GitHub.

Appendix: source

Thrown at packages/@n8n/imap/src/part-data.ts:36

		if (encoding === 'QUOTED-PRINTABLE') {
			return new QuotedPrintablePartData(data, charset);
		}

		if (encoding === '7BIT') {
			return new SevenBitPartData(data);
		}

		if (encoding === '8BIT' || encoding === 'BINARY') {
			return new BinaryPartData(data, charset);
		}

		if (encoding === 'UUENCODE') {
			return new UuencodedPartData(data);
		}

		// if it gets here, the encoding is not currently supported
		throw new Error('Unknown encoding ' + encoding);
	}
}

export class Base64PartData extends PartData {
	constructor(data: string) {
		super(Buffer.from(data, 'base64'));
	}
}

export class QuotedPrintablePartData extends PartData {
	constructor(data: string, charset?: string) {
		const decoded =
			charset?.toUpperCase() === 'UTF-8' ? utf8.decode(qp.decode(data)) : qp.decode(data);
		super(Buffer.from(decoded));
	}
}

export class SevenBitPartData extends PartData {

View on GitHub (pinned to 5ac6606e81)