FlowiseAI/Flowise · error · Error
Mem0: "Use Flowise Chat ID" is ON, but no runtime chat ID (o
Error message
Mem0: "Use Flowise Chat ID" is ON, but no runtime chat ID (overrideUserId) was provided.
What it means
Thrown by Mem0MemoryExtended.getEffectiveUserId() at loadMemoryVariables time when useFlowiseChatId is ON but the overrideUserId argument passed in is empty/falsy. The toggle promises to use the runtime chat ID, so an empty override is treated as a hard error rather than silently defaulting.
Source
Thrown at packages/components/nodes/memory/Mem0/Mem0.ts:257
this.inputKey = fields.inputKey ?? 'input'
this.appDataSource = fields.appDataSource
this.databaseEntities = fields.databaseEntities
this.chatflowid = fields.chatflowid
this.searchOnly = fields.searchOnly
this.useFlowiseChatId = fields.useFlowiseChatId
this.input = fields.input
this.orgId = fields.orgId
}
// Selects Mem0 user_id based on toggle state (Flowise chat ID or input field)
private getEffectiveUserId(overrideUserId?: string): string {
let effectiveUserId: string | undefined
if (this.useFlowiseChatId) {
if (overrideUserId) {
effectiveUserId = overrideUserId
} else {
throw new Error('Mem0: "Use Flowise Chat ID" is ON, but no runtime chat ID (overrideUserId) was provided.')
}
} else {
// If toggle is OFF, ALWAYS use the ID from the input field.
effectiveUserId = this.initialUserId
}
// This check is now primarily for the case where the toggle is OFF and the initialUserId was somehow empty (should be caught by init validation).
if (!effectiveUserId) {
throw new Error('Mem0: Could not determine a valid User ID for the operation. Check User ID input field.')
}
return effectiveUserId
}
async loadMemoryVariables(values: InputValues, overrideUserId = ''): Promise<MemoryVariables> {
const effectiveUserId = this.getEffectiveUserId(overrideUserId)
this.userId = effectiveUserId
if (this.memoryOptions) {
this.memoryOptions.user_id = effectiveUserIdView on GitHub (pinned to abe4a8601a)
Solutions
- Ensure the calling chatflow/API passes a non-empty chat or session ID so overrideUserId is populated.
- If you intend to use a fixed ID, turn OFF 'Use Flowise Chat ID' and set the User ID input instead.
- Wire the override to a non-empty variable (e.g. $chatId) that is guaranteed at runtime.
- In tests, pass a deterministic overrideUserId to loadMemoryVariables.
Example fix
// before await memory.loadMemoryVariables(values, '') // toggle ON // after await memory.loadMemoryVariables(values, sessionId || 'test-user')
Defensive patterns
Strategy: validation
Validate before calling
function resolveMem0Override(useFlowiseChatId: boolean, overrideUserId: string, fallback: string): string {
if (useFlowiseChatId) {
if (!overrideUserId) throw new Error('sessionId/chatId must be provided when Use Flowise Chat ID is ON')
return overrideUserId
}
return fallback
} Type guard
function isNonEmptyUserId(v: unknown): v is string {
return typeof v === 'string' && v.trim().length > 0
} Try / catch
try {
await memory.loadMemoryVariables(values, overrideUserId)
} catch (e) {
if ((e as Error).message.includes('no runtime chat ID')) {
// wire a non-empty sessionId/chatId into overrideUserId before retrying
}
throw e
} Prevention
- Always thread sessionId/chatId through to the memory node in API callers.
- In tests, pass a deterministic overrideUserId.
- UI: surface a warning when the toggle is ON but no chatId is wired.
When it happens
Trigger: Calling loadMemoryVariables(values, overrideUserId) (or the SDK default of '') while useFlowiseChatId is true and no chat/session ID was propagated through overrideUserId. Happens when the chatflow is invoked through a path that does not set sessionId/chatId.
Common situations: Running the Mem0 node outside a chat session context (e.g. test harness, API call without sessionId). Upstream node not forwarding the chat ID. Override variable resolving to empty string.
Related errors
- User ID field cannot be empty when "Use Flowise Chat ID" is
- Mem0: Could not determine a valid User ID for the operation.
- Invalid JSON in the Additional Configuration:
- Invalid JSON in the Additional Configuration:
- Invalid table name
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/a4cde89380d905f4.
Report an issue: GitHub.