n8n-io/n8n · error · ExpressionExtensionError
can't be used on value
Error message
${functionName} can't be used on ${String(value)} value What it means
checkIfValueDefinedOrThrow fired inside extend(): the receiver of the expression function is null or undefined, so the function cannot run on it. The message names the function and the actual value, making the null-propagation visible in the expression editor.
Solutions
- Guard the chain: use optional chaining or a default before calling the function (e.g. ($json.field ?? '').toSnakeCase())
- Fix the upstream step so the field is populated rather than null
- Check for typos in the field/property name — a wrong key resolves to undefined
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at packages/@n8n/expression-runtime/src/extensions/utils.ts:25 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/c9ae90b965d905c6.
Report an issue: GitHub.
Appendix: source
Thrown at packages/@n8n/expression-runtime/src/extensions/utils.ts:25
export const convertToDateTime = (value: string | Date | DateTime): DateTime | undefined => {
let converted: DateTime | undefined;
if (typeof value === 'string') {
converted = DateTime.fromJSDate(new Date(value));
if (converted.invalidReason !== null) {
return;
}
} else if (value instanceof Date) {
converted = DateTime.fromJSDate(value);
} else if (DateTime.isDateTime(value)) {
converted = value;
}
return converted;
};
export function checkIfValueDefinedOrThrow<T>(value: T, functionName: string): void {
if (value === undefined || value === null) {
throw new ExpressionExtensionError(`${functionName} can't be used on ${String(value)} value`, {
description: `To ignore this error, add a ? to the variable before this function, e.g. my_var?.${functionName}`,
});
}
}
View on GitHub (pinned to 5ac6606e81)