mem0ai/mem0 · error · Error
HTTP ${resp.status}: ${detail}
Error message
HTTP ${resp.status}: ${detail} What it means
Generic HTTP failure thrown by PlatformBackend._request when the Mem0 platform API (api.mem0.ai) returns any non-OK status other than 400/401/404 (e.g. 403, 409, 422, 429, 5xx). The message embeds the HTTP status code plus the server-provided detail from the JSON body (body.detail or body.message) or the status text when the body is not JSON. Requests carry a 30s AbortSignal timeout and a Token Authorization header.
Source
Thrown at integrations/openclaw/backend/platform.ts:84
try {
const body = (await resp.json()) as Record<string, unknown>;
detail =
((body.detail ?? body.message ?? JSON.stringify(body)) as string) ??
resp.statusText;
} catch {
detail = resp.statusText;
}
throw new APIError(path, detail);
}
if (!resp.ok) {
let detail: string = resp.statusText;
try {
const body = (await resp.json()) as Record<string, unknown>;
detail = (body.detail ?? body.message ?? resp.statusText) as string;
} catch {
/* ignore */
}
throw new Error(`HTTP ${resp.status}: ${detail}`);
}
if (resp.status === 204) {
return {};
}
return resp.json();
}
async add(
content?: string,
messages?: Record<string, unknown>[],
opts: AddOptions = {},
): Promise<Record<string, unknown>> {
const payload: Record<string, unknown> = {};
if (messages) {
payload.messages = messages;
} else if (content) {
payload.messages = [{ role: "user", content }];View on GitHub (pinned to 001c235229)
Solutions
- Read the embedded status code: 429 means back off and retry with exponential delay; 5xx is transient — retry once; 403/422 are request problems — fix the API key scope or payload.
- Verify the API key is active and the baseUrl matches your Mem0 platform region in openclaw.json (plugins section).
- For 422, log the full detail string — it names the exact invalid field sent to /v1/memories/ or /v2/entities/.
- Check status.mem0.ai for ongoing incidents if 5xx persists.
Example fix
// before
await backend.add(content);
// unhandled: HTTP 429: Too Many Requests
// after
try {
await backend.add(content);
} catch (err) {
const msg = err instanceof Error ? err.message : String(err);
const status = Number(msg.match(/^HTTP (\d+):/)?.[1]);
if (status === 429 || status >= 500) {
await new Promise((r) => setTimeout(r, 2000));
return backend.add(content); // retry once
}
throw err;
} Defensive patterns
Strategy: retry
Validate before calling
function classifyHttpError(err: unknown): { status?: number; retryable: boolean } {
const msg = err instanceof Error ? err.message : String(err);
const m = msg.match(/^HTTP (\d+):/);
if (!m) return { retryable: false };
const status = Number(m[1]);
return { status, retryable: status === 429 || status >= 500 };
} Type guard
function isHttpError(err: unknown): err is Error & { message: string } {
return err instanceof Error && /^HTTP \d+:/.test(err.message);
} Try / catch
try {
await backend.add(content);
} catch (err) {
const { status, retryable } = classifyHttpError(err);
if (retryable) { await sleep(2000); return backend.add(content); }
if (status === 403) throw new Error('API key lacks access or wrong baseUrl region');
throw err;
} Prevention
- Confirm baseUrl matches your Mem0 platform region before deploying.
- Wrap bulk imports with rate-limit-aware retries (429 backoff).
- Log the full message — the embedded server detail names the invalid field for 422s.
When it happens
Trigger: Calling any PlatformBackend method (add, search, delete, deleteEntities, etc.) against api.mem0.ai where the response status is not ok and not 400/401/404: 403 (wrong region/baseUrl), 422 (payload validation), 429 (rate limit), 500/502/503 (server errors). Also a custom baseUrl pointing at a proxy or non-Mem0 service that returns HTML, in which case detail falls back to resp.statusText.
Common situations: Rate limiting during bulk memory imports; expired API key that is syntactically valid but revoked (403 instead of 401); wrong baseUrl (EU vs US platform); transient 5xx during platform incidents; proxy/gateway between the agent and api.mem0.ai rewriting responses.
Related errors
- Either memoryId or --all is required
- At least one entity ID is required for deleteEntities.
- HTTP error! status: ${response.status}
- DeepSeek LLM failed: ${message}
- LiteLLM failed: ${message}
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/7b4c97acf8eea2aa.
Report an issue: GitHub.