n8n-io/n8n · error · NodeOperationError
User ID is not available. This node requires an…
Error message
User ID is not available. This node requires an authenticated user session.
What it means
Thrown by ensureUserId/getUserScopedSlot when the execution context has no authenticated user ID. The helper reads context.additionalData.userId and requires a non-empty string; if it is absent the user-scoped slot (collection/table/namespace name) cannot be derived. This guards user-scoped vector stores (e.g. AI memory).
Solutions
- Run the user-scoped memory node from an authenticated UI session so additionalData.userId is populated.
- If triggering via API/webhook, ensure the execution carries the owning user (check n8n user/owner execution settings).
- For non-interactive workloads, use a non-user-scoped vector store node instead.
- Confirm the n8n version propagates additionalData.userId to the execution context for your trigger type.
Example fix
// before: workflow triggered by anonymous webhook -> additionalData.userId undefined // after: run from an authenticated session, or switch to a non-user-scoped store node
Defensive patterns
Strategy: type-guard
Validate before calling
const ad = (context as any).additionalData; const userId = ad && typeof ad === 'object' && typeof ad.userId === 'string' ? ad.userId : undefined; if (!userId) { /* switch to non-user-scoped node, or abort with a clear message */ } Type guard
function hasUserId(c: unknown): c is { additionalData: { userId: string } } { const ad = (c as any)?.additionalData; return !!ad && typeof ad.userId === 'string' && ad.userId.length > 0; } Try / catch
try { const slot = getUserScopedSlot(context, prefix); } catch (e) { if (/User ID is not available/.test(e.message)) { /* use non-scoped fallback or stop */ } else throw e; } Prevention
- Only invoke user-scoped nodes within authenticated UI sessions.
- For API/webhook-driven executions, prefer non-user-scoped stores.
- Confirm your n8n version forwards additionalData.userId to the execution context.
- Surface the missing-session condition early in the workflow, not deep in a memory node.
When it happens
Trigger: getUserScopedSlot or ensureUserId is called in a context where additionalData.userId is undefined or non-string — e.g. executing the workflow via API/trigger without a user session, running in a worker/process that does not propagate the user, or using a user-scoped memory node outside an authenticated UI session.
Common situations: Manual/test run without a logged-in owner; webhook/queue-triggered execution that does not carry a user; self-hosted setup where the user session is not forwarded to the executing process; using a user-scoped node in a context that n8n does not consider user-authenticated.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/d20a6e3830430525.
Report an issue: GitHub.
Appendix: source
Thrown at packages/@n8n/nodes-langchain/nodes/vector_store/shared/userScoped.ts:35
): string {
const userId = ensureUserId(context, itemIndex);
return `${prefix}_${userId}`.replace(/[^a-zA-Z0-9_]/g, '_');
}
export function ensureUserId(
context: IExecuteFunctions | ISupplyDataFunctions | ILoadOptionsFunctions,
itemIndex?: number,
): string {
const userId =
'additionalData' in context &&
typeof context.additionalData === 'object' &&
context.additionalData !== null &&
'userId' in context.additionalData
? context.additionalData.userId
: undefined;
if (typeof userId !== 'string' || !userId) {
throw new NodeOperationError(
context.getNode(),
'User ID is not available. This node requires an authenticated user session.',
{ itemIndex },
);
}
return userId;
}
View on GitHub (pinned to 5ac6606e81)