{"record":{"id":"60ad709a1b4d2b1a","repo":"n8n-io/n8n","slug":"invalid-loadprevioussession-option-value","errorCode":null,"errorMessage":"Invalid loadPreviousSession option: ${value}","messagePattern":"Invalid loadPreviousSession option: (.+?)","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/types.ts","lineNumber":17,"sourceCode":"import type { INode } from 'n8n-workflow';\nimport { NodeOperationError } from 'n8n-workflow';\n\nconst validOptions = ['notSupported', 'memory', 'manually'] as const;\nexport type AuthenticationChatOption = 'none' | 'basicAuth' | 'n8nUserAuth';\nexport type LoadPreviousSessionChatOption = (typeof validOptions)[number];\n\nfunction isValidLoadPreviousSessionOption(value: unknown): value is LoadPreviousSessionChatOption {\n\treturn typeof value === 'string' && (validOptions as readonly string[]).includes(value);\n}\n\nexport function assertValidLoadPreviousSessionOption(\n\tvalue: string | undefined,\n\tnode: INode,\n): asserts value is LoadPreviousSessionChatOption | undefined {\n\tif (value && !isValidLoadPreviousSessionOption(value)) {\n\t\tthrow new NodeOperationError(node, `Invalid loadPreviousSession option: ${value}`);\n\t}\n}\n","sourceCodeStart":1,"sourceCodeEnd":20,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/types.ts#L1-L20","documentation":"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.","triggerScenarios":"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'].","commonSituations":"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.","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."],"exampleFix":"// before: loadPreviousSession = 'lastSession'\n// after:  loadPreviousSession = 'memory'","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"const VALID_LOAD_PREVIOUS = ['notSupported', 'memory', 'manually'] as const;\nfunction isLoadPreviousSession(v: unknown): v is typeof VALID_LOAD_PREVIOUS[number] | undefined {\n  return v === undefined || (typeof v === 'string' && (VALID_LOAD_PREVIOUS as readonly string[]).includes(v));\n}","tryCatchPattern":null,"preventionTips":["Validate workflow JSON against the node's current parameter schema on import.","When programmatically building nodeParameters, use the typed validOptions array, not string literals."],"tags":["validation","configuration","chat-trigger","enum","workflow-import"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}