mem0ai/mem0 · error · Error
Failed to get user ID: ${error instanceof Error ? error.mess
Error message
Failed to get user ID: ${error instanceof Error ? error.message : String(error)} What it means
Error "Failed to get user ID: ${error instanceof Error ? error.message : String(error)}" thrown in mem0ai/mem0.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/vectorize.ts:325
values: [0],
metadata: { userId: randomUserId },
};
await fetch(
`https://api.cloudflare.com/client/v4/accounts/${this.accountId}/vectorize/v2/indexes/memory_migrations/upsert`,
{
method: "POST",
headers: {
"Content-Type": "application/x-ndjson",
Authorization: `Bearer ${this.client?.apiToken}`,
},
body: JSON.stringify(data) + "\n", // ndjson format
},
);
return randomUserId;
} catch (error) {
console.error("Error getting user ID:", error);
throw new Error(
`Failed to get user ID: ${error instanceof Error ? error.message : String(error)}`,
);
}
}
async setUserId(userId: string): Promise<void> {
await this.initialize();
try {
// Get existing point ID
const result: any = await this.client?.vectorize.indexes.query(
"memory_migrations",
{
account_id: this.accountId,
vector: [0],
topK: 1,
returnMetadata: "all",
},
);View on GitHub (pinned to 001c235229)
Solutions
- Verify the Cloudflare API token has account-level read permissions.
- Check network connectivity to the Cloudflare API.
- Retry with exponential backoff for transient failures.
When it happens
Trigger: Thrown at mem0-ts/src/oss/src/vector_stores/vectorize.ts:325 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/e4baa14220305516.
Report an issue: GitHub.