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
- Re-open the Chat Trigger node's 'Load Previous Session' dropdown and pick a supported value (notSupported, memory, or manually).
- Edit the workflow JSON so nodeParameters.loadPreviousSession is one of the allowed values or remove it.
- 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
- Validate workflow JSON against the node's current parameter schema on import.
- When programmatically building nodeParameters, use the typed validOptions array, not string literals.
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
- Invalid date format
- Could not configure Limit Wait Time
- concurrencyMode must be 'sequential' or 'concurrent', got ${
- Model ID is required
- Invalid delegate sub-agent tool name "${name}": must start w
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/60ad709a1b4d2b1a.
Report an issue: GitHub.