n8n-io/n8n · error
UNSAFE_MEMORY_SESSION_KEY_EXPRESSION
UNSAFE_MEMORY_SESSION_KEY_EXPRESSION
Error message
'${nodeName}' parameter '${parameterPath}' uses $json in an AI memory subnode session key. Use an explicit node reference such as nodeJson(trigger, 'message.chat.id') or $('Trigger').item.json.message.chat.id. What it means
Error "'${nodeName}' parameter '${parameterPath}' uses $json in an AI memory subnode session key. Use an explicit node reference such as nodeJson(trigger, 'message.chat.id') or $('Trigger').item.json.message.chat.id." thrown in n8n-io/n8n.
Source
Thrown at packages/@n8n/workflow-sdk/src/workflow-builder/plugins/validators/memory-session-key-validator.ts:40
function isMemorySubnode(node: NodeInstance<string, string, unknown>): boolean {
return hasSubnodeType(node) && node._subnodeType === MEMORY_SUBNODE_TYPE;
}
function usesFromInputSessionId(parameters: Record<string, unknown>): boolean {
return parameters.sessionIdType === 'fromInput';
}
function isUnsafeSessionExpression(value: unknown): value is string {
return (
typeof value === 'string' &&
value.includes('$json') &&
(value.startsWith('=') || value.includes('{{'))
);
}
function createIssue(nodeName: string, parameterPath: string): ValidationIssue {
return {
code: 'UNSAFE_MEMORY_SESSION_KEY_EXPRESSION',
message: `'${nodeName}' parameter '${parameterPath}' uses $json in an AI memory subnode session key. Use an explicit node reference such as nodeJson(trigger, 'message.chat.id') or $('Trigger').item.json.message.chat.id.`,
severity: 'error',
violationLevel: 'major',
nodeName,
parameterPath,
};
}
/**
* Validator for AI memory subnode session key expressions.
*
* Checks for:
* - `$json` in manually configured memory session keys
* - Does not flag Chat Trigger's `fromInput` memory mode
*/
export const memorySessionKeyValidator: ValidatorPlugin = {
id: 'core:memory-session-key',
name: 'Memory Session Key Validator',View on GitHub (pinned to 5ac6606e81)
When it happens
Trigger: Thrown at packages/@n8n/workflow-sdk/src/workflow-builder/plugins/validators/memory-session-key-validator.ts:40 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/da9e83f733a6959e.
Report an issue: GitHub.