{"record":{"id":"7c5c11df25d9401f","repo":"mem0ai/mem0","slug":"timed-out-waiting-for-memory-event-eventid-to-c","errorCode":null,"errorMessage":"Timed out waiting for memory event ${eventId} to complete","messagePattern":"Timed out waiting for memory event (.+?) to complete","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"warning","filePath":"integrations/n8n-nodes-mem0/nodes/Mem0/Mem0.node.ts","lineNumber":621,"sourceCode":"): Promise<IDataObject | IDataObject[]> {\n\tfor (let attempt = 0; attempt < MAX_POLL_ATTEMPTS; attempt++) {\n\t\tconst event = await request('GET', `/v1/event/${encodeURIComponent(eventId)}/`);\n\t\tconst status = event.status as string;\n\t\tif (status === 'SUCCEEDED') {\n\t\t\t// Match the shape of search/getAll (a clean array); fall back to the envelope.\n\t\t\treturn Array.isArray(event.results) ? (event.results as IDataObject[]) : event;\n\t\t}\n\t\tif (status === 'FAILED') {\n\t\t\tconst reason = (event.error as string) || (event.message as string) || 'unknown error';\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tctx.getNode(),\n\t\t\t\t`Mem0 memory event ${eventId} failed: ${reason}`,\n\t\t\t\t{ itemIndex },\n\t\t\t);\n\t\t}\n\t\tawait sleep(POLL_INTERVAL_MS);\n\t}\n\tthrow new NodeOperationError(\n\t\tctx.getNode(),\n\t\t`Timed out waiting for memory event ${eventId} to complete`,\n\t\t{ itemIndex },\n\t);\n}\n","sourceCodeStart":603,"sourceCodeEnd":627,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/integrations/n8n-nodes-mem0/nodes/Mem0/Mem0.node.ts#L603-L627","documentation":"POST /auth/register is only for bootstrapping: it creates the first admin account and is blocked once any user row exists (checked via a COUNT before insert). Once count > 0, further registrations get 403 'Registration is closed' regardless of role or intent — subsequent users must be created by an admin through the user-management endpoints.","triggerScenarios":"Calling POST /auth/register a second time after /setup was completed; two team members racing to claim the first-admin slot; attempting to self-register on an already-initialized deployment.","commonSituations":"Re-running a bootstrap script against an already-initialized environment; CI recreating containers but keeping the DB volume (users persist, so register 403s); confusion between first-admin bootstrap and normal user creation.","solutions":["Log in with the existing admin (POST /auth/login) instead of registering again.","To add users, use the admin user-management API while authenticated as admin.","If the instance should truly start over, wipe the users table (or the whole DB volume) and re-run /setup.","Make deployment scripts idempotent: check GET /auth/setup-status first and skip register when needsSetup is false."],"exampleFix":"# before\nrequests.post(f\"{BASE}/auth/register\", json={...})  # 403 on initialized server\n\n# after\nstatus = requests.get(f\"{BASE}/auth/setup-status\").json()\nif status[\"needsSetup\"]:\n    requests.post(f\"{BASE}/auth/register\", json={...})\nelse:\n    token = login(existing_admin_email, password)","handlingStrategy":"validation","validationCode":"def bootstrap_admin(base: str, name: str, email: str, password: str) -> dict:\n    status = requests.get(f\"{base}/auth/setup-status\").json()\n    if not status[\"needsSetup\"]:\n        return requests.post(f\"{base}/auth/login\", json={\"email\": email, \"password\": password}).json()\n    return requests.post(f\"{base}/auth/register\",\n                         json={\"name\": name, \"email\": email, \"password\": password}).json()","typeGuard":"def needs_setup(setup_status: dict) -> bool:\n    return bool(setup_status.get(\"needsSetup\"))","tryCatchPattern":"if resp.status_code == 403 and \"Registration is closed\" in resp.text:\n    creds = login(base, admin_email, admin_password)  # instance already initialized\nelse:\n    resp.raise_for_status()","preventionTips":["Always query /auth/setup-status before registering.","Record admin credentials in a secret manager at setup time.","Make bootstrap scripts idempotent across fresh and existing instances."],"tags":["auth","bootstrap","http-403","rest-server"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}