mem0ai/mem0 · error · Error
HTTP ${resp.status}: ${detail}
Error message
HTTP ${resp.status}: ${detail} What it means
Raised inside require_admin when authentication came via ADMIN_API_KEY or AUTH_DISABLED, a default user was found in the users table, but that default user's role is not 'admin' (e.g. 'member'). The bootstrap path assumes the first user is an admin; a non-admin first user blocks admin access for the admin-key/disabled paths. This is a 403.
Source
Thrown at cli/node/src/backend/platform.ts:93
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 {};
}
const data = await resp.json();
// Pull the unclaimed-Agent-Mode notice out of the body (or the header
// fallback for endpoints returning non-dict / non-dict-leading payloads)
// and stash for end-of-command surfacing.
let notice: string | null = null;
if (
data &&
typeof data === "object" &&
!Array.isArray(data) &&
"mem0_notice" in data
) {
notice = (data as Record<string, unknown>).mem0_notice as string;View on GitHub (pinned to 001c235229)
Solutions
- Promote the first user to admin: UPDATE users SET role='admin' WHERE id=<first_user_id>, or re-create the DB so /setup can register the first user as admin.
- Authenticate as an existing user whose role is 'admin' with a Bearer token instead of ADMIN_API_KEY/AUTH_DISABLED.
- If the users table has no admin at all, wipe users and re-run /setup so the first registered account becomes admin.
Example fix
-- before SELECT role FROM users LIMIT 1; -- 'member' -- after UPDATE users SET role='admin' WHERE id = (SELECT id FROM users ORDER BY created_at LIMIT 1);
Defensive patterns
Strategy: validation
Validate before calling
users = admin_client.get(f"{BASE}/users").json()
if users and getattr(users[0], "role", "member") != "admin":
raise RuntimeError("First user must have role='admin' for ADMIN_API_KEY/AUTH_DISABLED paths") Prevention
- Only seed the DB with an admin as the first user.
- Never downgrade the first-created user without promoting another admin.
- Audit roles after any manual DB seeding.
When it happens
Trigger: AUTH_DISABLED=true or ADMIN_API_KEY set, the first user in the users table was created with a non-admin role (custom DB seed, manual insert, or a role change), then calling an admin endpoint such as DELETE /memories or POST /reset.
Common situations: Someone seeded the database with a regular member user before any admin existed; an operator downgraded the first user's role in the DB; a deployment script creates a default non-admin user for testing.
Related errors
- At least one entity ID is required for deleteEntities.
- Mem0 memory add failed: ${(addResp.message as string) || 'un
- Timed out waiting for memory event ${eventId} to complete
- Authentication failed. Your API key may be invalid or expire
- Authentication failed. Your API key may be invalid or expire
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/45437a01329d7a32.
Report an issue: GitHub.