mem0ai/mem0 · error · Error
Failed to set user ID: ${error instanceof Error ? error.mess
Error message
Failed to set user ID: ${error instanceof Error ? error.message : String(error)} What it means
Error "Failed to set 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:365
const data: VectorizeVector = {
id: pointId,
values: [0],
metadata: { userId },
};
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
},
);
} catch (error) {
console.error("Error setting user ID:", error);
throw new Error(
`Failed to set user ID: ${error instanceof Error ? error.message : String(error)}`,
);
}
}
async initialize(): Promise<void> {
if (!this._initPromise) {
this._initPromise = this._doInitialize();
}
return this._initPromise;
}
private async _doInitialize(): Promise<void> {
await this.ensureClient();
try {
// Check if the index already exists
let indexFound = false;
for await (const idx of this.client!.vectorize.indexes.list({View on GitHub (pinned to 001c235229)
Solutions
- Verify the Cloudflare API token has write permissions for Vectorize.
- Check that the metadata payload is within Vectorize size limits.
- Retry transient network failures with backoff.
When it happens
Trigger: Thrown at mem0-ts/src/oss/src/vector_stores/vectorize.ts:365 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/5ecfc3dca967a4cb.
Report an issue: GitHub.