n8n-io/n8n · error · NodeOperationError

Invalid loadPreviousSession option: ${value}

Error message

Invalid loadPreviousSession option: ${value}

What it means

assertValidLoadPreviousSessionOption throws a NodeOperationError when the Chat Trigger's 'loadPreviousSession' parameter is truthy but not one of the allowed values ('notSupported', 'memory', 'manually'). This guards against an unrecognized enum value reaching downstream logic.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/types.ts:17

import type { INode } from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow';

const validOptions = ['notSupported', 'memory', 'manually'] as const;
export type AuthenticationChatOption = 'none' | 'basicAuth' | 'n8nUserAuth';
export type LoadPreviousSessionChatOption = (typeof validOptions)[number];

function isValidLoadPreviousSessionOption(value: unknown): value is LoadPreviousSessionChatOption {
	return typeof value === 'string' && (validOptions as readonly string[]).includes(value);
}

export function assertValidLoadPreviousSessionOption(
	value: string | undefined,
	node: INode,
): asserts value is LoadPreviousSessionChatOption | undefined {
	if (value && !isValidLoadPreviousSessionOption(value)) {
		throw new NodeOperationError(node, `Invalid loadPreviousSession option: ${value}`);
	}
}

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Re-open the Chat Trigger node's 'Load Previous Session' dropdown and pick a supported value (notSupported, memory, or manually).
  2. Edit the workflow JSON so nodeParameters.loadPreviousSession is one of the allowed values or remove it.
  3. Re-export the workflow from a current n8n version to resolve stale enum values.

Example fix

// before: loadPreviousSession = 'lastSession'
// after:  loadPreviousSession = 'memory'
Defensive patterns

Strategy: type-guard

Type guard

const VALID_LOAD_PREVIOUS = ['notSupported', 'memory', 'manually'] as const;
function isLoadPreviousSession(v: unknown): v is typeof VALID_LOAD_PREVIOUS[number] | undefined {
  return v === undefined || (typeof v === 'string' && (VALID_LOAD_PREVIOUS as readonly string[]).includes(v));
}

Prevention

When it happens

Trigger: assertValidLoadPreviousSessionOption(value, node) is called with a value that is a non-empty string AND not included in the readonly validOptions array ['notSupported','memory','manually'].

Common situations: Importing a workflow JSON exported from a different/older n8n version that had an additional option; manually editing nodeParameters to an invalid value; a community node or template referencing a removed option.

Related errors


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