n8n-io/n8n · error · ExpressionExtensionError

cannot convert to float, expected . as decimal separator

Error message

cannot convert to float, expected . as decimal separator

What it means

toFloat() refuses strings containing a comma. n8n's convention is a dot as decimal separator, and a comma most likely means either a thousands separator or a locale-formatted number, which silent parseFloat would misparse (e.g. '1,5' → 1). The guard forces the user to disambiguate before conversion.

Solutions

  1. Use a dot as the decimal separator: '1.5' not '1,5'
  2. Remove thousands separators before converting (e.g. .replace(/,/g, '') in a Code node) when the comma is a grouping symbol
  3. Convert locale-formatted strings explicitly in a Code node with parseInt/parseFloat and documented assumptions
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/@n8n/expression-runtime/src/extensions/string-extensions.ts:244 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/9f5110ab91cb65c5. Report an issue: GitHub.

Appendix: source

Thrown at packages/@n8n/expression-runtime/src/extensions/string-extensions.ts:244

		return encodeURI(value.toString());
	}
	return encodeURIComponent(value.toString());
}

function toInt(value: string, extraArgs: Array<number | undefined>) {
	const [radix] = extraArgs;
	const int = parseInt(value.replace(CURRENCY_REGEXP, ''), radix);

	if (isNaN(int)) {
		throw new ExpressionExtensionError('cannot convert to integer');
	}

	return int;
}

function toFloat(value: string) {
	if (value.includes(',')) {
		throw new ExpressionExtensionError('cannot convert to float, expected . as decimal separator');
	}

	const float = parseFloat(value.replace(CURRENCY_REGEXP, ''));

	if (isNaN(float)) {
		throw new ExpressionExtensionError('cannot convert to float');
	}

	return float;
}

function toNumber(value: string) {
	const num = Number(value.replace(CURRENCY_REGEXP, ''));

	if (isNaN(num)) {
		throw new ExpressionExtensionError('cannot convert to number');
	}

View on GitHub (pinned to 5ac6606e81)