{"record":{"id":"f0d5b1f8bf32117f","repo":"Significant-Gravitas/AutoGPT","slug":"str-exc-f0d5b1","errorCode":null,"errorMessage":"str(exc)","messagePattern":"str\\(exc\\)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"warning","filePath":"autogpt_platform/backend/backend/api/features/admin/memory_admin_routes.py","lineNumber":303,"sourceCode":"\n@router.get(\"/{user_id}/overview\", response_model=MemoryOverview)\nasync def get_memory_overview(\n    request: Request,\n    user_id: Annotated[str, Path(description=\"User id or 'me'\")],\n    caller_id: Annotated[str, Depends(get_user_id)],\n    jwt_payload: Annotated[dict, Security(get_jwt_payload)],\n) -> MemoryOverview:\n    target = _resolve_user_id(user_id, caller_id)\n    _audit_cross_user_access(\n        request=request,\n        caller_id=caller_id,\n        target_id=target,\n        jwt_payload=jwt_payload,\n    )\n    try:\n        group_id = derive_group_id(target)\n    except ValueError as exc:\n        raise HTTPException(status_code=400, detail=str(exc))\n\n    driver = _open_driver(group_id)\n    try:\n        entities = await _count(driver, \"MATCH (n:Entity) RETURN count(n) AS c\")\n        episodes = await _count(driver, \"MATCH (n:Episodic) RETURN count(n) AS c\")\n        relates = await _count(\n            driver, \"MATCH ()-[e:RELATES_TO]->() RETURN count(e) AS c\"\n        )\n        mentions = await _count(\n            driver, \"MATCH ()-[e:MENTIONS]->() RETURN count(e) AS c\"\n        )\n        communities = await _count(driver, \"MATCH (n:Community) RETURN count(n) AS c\")\n    finally:\n        await driver.close()\n\n    return MemoryOverview(\n        user_id=target,\n        group_id=group_id,","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/admin/memory_admin_routes.py#L285-L321","documentation":"HTTP 400 from the admin memory overview endpoint. derive_group_id(user_id) raised ValueError: per backend/copilot/graphiti/client.py:49 it requires a non-empty user_id of only [a-zA-Z0-9_-] (max length enforced) and raises if sanitization would change the input — so empty ids, ids containing other characters (including dots, @, spaces), or over-long ids all fail. The message is forwarded as the response detail.","triggerScenarios":"GET /admin/memory/users/{user_id}/overview where user_id is empty, contains whitespace/@/unicode (any char outside [a-zA-Z0-9_-]), or exceeds the max group-id length. _resolve_user_id may also pass through a malformed caller-supplied id.","commonSituations":"Passing an email or display name instead of the UUID user_id; URL-encoding artifacts (%20, %40) reaching the handler; test fixtures with synthetic ids like 'user@example.com'.","solutions":["Pass the exact Supabase user UUID (hyphens are allowed) as user_id.","Read the detail message — it distinguishes empty, sanitized-to-empty, and invalid-character cases.","Trim whitespace and re-check the id client-side before calling.","If a legitimately-shaped id still fails, check its length against the group-id cap."],"exampleFix":"// before\nfetch(`/admin/memory/users/${encodeURIComponent(email)}/overview`)\n\n// after\nfetch(`/admin/memory/users/${encodeURIComponent(user.uuid)}/overview`)","handlingStrategy":"validation","validationCode":"const GROUP_ID_RE = /^[A-Za-z0-9_-]+$/;\nif (!user_id || !GROUP_ID_RE.test(user_id)) throw new Error('user_id must match [a-zA-Z0-9_-]+');","typeGuard":"function isValidUserId(id: string): boolean { return /^[A-Za-z0-9_-]+$/.test(id) && id.length > 0; }","tryCatchPattern":"try { const o = await memoryOverview(userId); } catch (e) { if (e.status === 400 && /group_id/.test(e.detail)) { /* bad id format: fetch the canonical UUID from the user list and retry once */ } }","preventionTips":["Always pass the Supabase UUID, never email/username.","Trim whitespace from ids sourced from spreadsheets or copy-paste.","Select users from a picker backed by the user API instead of free-text input."],"tags":["http-400","admin-api","memory","validation","user-id"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}