n8n-io/n8n · error · UserError

Invalid date format

Error message

Invalid date format

What it means

configureWaitTillDate throws a UserError('Invalid date format') when new Date(...) produced an Invalid Date — i.e. isNaN(waitTill.getTime()) is true. This happens for the 'maxDateAndTime' branch when the configured date/time string cannot be parsed by the JS Date constructor. Note: this UserError is immediately caught by the surrounding try/catch and rethrown as the NodeOperationError in error 767, so end users normally see 767's message with this as the description.

Solutions

  1. Open the Chat Trigger's 'Limit Wait Time' option and set a valid date/time in the picker.
  2. Prefer the 'afterTimeInterval' limit type (amount + unit) which does not depend on parsing a date string.
  3. Ensure any expression feeding maxDateAndTime returns an ISO-8601 string.

Example fix

// before: options.limitWaitTime.values.maxDateAndTime = ''
// after:  options.limitWaitTime.values.maxDateAndTime = '2025-12-31T23:59:00.000Z'
Defensive patterns

Strategy: validation

Validate before calling

// Validate the date string before constructing the Date.
const raw = limitOptions.maxDateAndTime;
if (typeof raw === 'string' && raw.trim() !== '') {
  const d = new Date(raw);
  if (Number.isNaN(d.getTime())) throw new Error(`maxDateAndTime is not a parseable date: ${raw}`);
}

Type guard

function isParsableDate(v: unknown): v is string {
  return typeof v === 'string' && v.trim() !== '' && !Number.isNaN(new Date(v).getTime());
}

Prevention

When it happens

Trigger: limitOptions.limitType !== 'afterTimeInterval' and new Date(limitOptions.maxDateAndTime) yields Invalid Date (empty string, malformed locale, undefined, or a non-ISO string).

Common situations: The Limit Wait Time 'maxDateAndTime' field is blank or got corrupted; a workflow imported with a localized/non-ISO date string; the date-time picker value was not serialized correctly.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/efa923d8372b8511. Report an issue: GitHub.

Appendix: source

Thrown at packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/util.ts:52

				if (limitOptions.resumeUnit === 'minutes') {
					waitAmount *= 60;
				}
				if (limitOptions.resumeUnit === 'hours') {
					waitAmount *= 60 * 60;
				}
				if (limitOptions.resumeUnit === 'days') {
					waitAmount *= 60 * 60 * 24;
				}

				waitAmount *= 1000;
				waitTill = new Date(new Date().getTime() + waitAmount);
			} else {
				waitTill = new Date(limitOptions.maxDateAndTime as string);
			}

			if (isNaN(waitTill.getTime())) {
				throw new UserError('Invalid date format');
			}
		} catch (error) {
			throw new NodeOperationError(context.getNode(), 'Could not configure Limit Wait Time', {
				description: error.message,
			});
		}
	}

	return waitTill;
}

export const configureInputs = (parameters: { options?: { memoryConnection?: boolean } }) => {
	const inputs = [
		{
			type: 'main',
		},
	];
	if (parameters.options?.memoryConnection) {

View on GitHub (pinned to 5ac6606e81)