{"record":{"id":"c9ae90b965d905c6","repo":"n8n-io/n8n","slug":"functionname-can-t-be-used-on-string-value","errorCode":null,"errorMessage":"${functionName} can't be used on ${String(value)} value","messagePattern":"(.+?) can't be used on (.+?) value","errorType":"exception","errorClass":"ExpressionExtensionError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/expression-runtime/src/extensions/utils.ts","lineNumber":25,"sourceCode":"export const convertToDateTime = (value: string | Date | DateTime): DateTime | undefined => {\n\tlet converted: DateTime | undefined;\n\n\tif (typeof value === 'string') {\n\t\tconverted = DateTime.fromJSDate(new Date(value));\n\t\tif (converted.invalidReason !== null) {\n\t\t\treturn;\n\t\t}\n\t} else if (value instanceof Date) {\n\t\tconverted = DateTime.fromJSDate(value);\n\t} else if (DateTime.isDateTime(value)) {\n\t\tconverted = value;\n\t}\n\treturn converted;\n};\n\nexport function checkIfValueDefinedOrThrow<T>(value: T, functionName: string): void {\n\tif (value === undefined || value === null) {\n\t\tthrow new ExpressionExtensionError(`${functionName} can't be used on ${String(value)} value`, {\n\t\t\tdescription: `To ignore this error, add a ? to the variable before this function, e.g. my_var?.${functionName}`,\n\t\t});\n\t}\n}\n","sourceCodeStart":7,"sourceCodeEnd":30,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/expression-runtime/src/extensions/utils.ts#L7-L30","documentation":"Error \"${functionName} can't be used on ${String(value)} value\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/expression-runtime/src/extensions/utils.ts:25 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}