{"record":{"id":"80b22f8220e6ab6d","repo":"Significant-Gravitas/AutoGPT","slug":"user-user-id-not-found","errorCode":null,"errorMessage":"User {user_id} not found","messagePattern":"User (.+?) not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"autogpt_platform/backend/backend/api/features/admin/rate_limit_admin_routes.py","lineNumber":194,"sourceCode":"\n@router.get(\n    \"/rate_limit/tier\",\n    response_model=UserTierResponse,\n    summary=\"Get User Rate Limit Tier\",\n)\nasync def get_user_rate_limit_tier(\n    user_id: str,\n    admin_user_id: str = Security(get_user_id),\n) -> UserTierResponse:\n    \"\"\"Get a user's current rate-limit tier. Admin-only.\n\n    Returns 404 if the user does not exist in the database.\n    \"\"\"\n    logger.info(\"Admin %s checking tier for user %s\", admin_user_id, user_id)\n\n    resolved_email = await get_user_email_by_id(user_id)\n    if resolved_email is None:\n        raise HTTPException(status_code=404, detail=f\"User {user_id} not found\")\n\n    tier = await get_user_tier(user_id)\n    return UserTierResponse(user_id=user_id, tier=tier)\n\n\n@router.post(\n    \"/rate_limit/tier\",\n    response_model=UserTierResponse,\n    summary=\"Set User Rate Limit Tier\",\n)\nasync def set_user_rate_limit_tier(\n    request: SetUserTierRequest,\n    admin_user_id: str = Security(get_user_id),\n) -> UserTierResponse:\n    \"\"\"Set a user's rate-limit tier. Admin-only.\n\n    Returns 404 if the user does not exist in the database.\n    \"\"\"","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/admin/rate_limit_admin_routes.py#L176-L212","documentation":"HTTP 404 from the admin get-tier endpoint: get_user_email_by_id(user_id) returned None, which the route treats as proof the user does not exist in the database. No tier lookup is attempted.","triggerScenarios":"GET the user rate-limit tier route with a user_id that has no User row: malformed or foreign UUID, user deleted, or pointing at a different environment's database than where the user lives.","commonSituations":"Copy-pasting a user id from a staging ticket into a prod admin tool (or vice versa); users deleted between id capture and the tier check; UUIDs with a missing or extra segment after manual transcription; Supabase auth user created but User row not yet synced.","solutions":["Verify the user_id exists as a User row in the target database","Copy the full UUID without truncation (watch log-prefixed 12-char forms)","Confirm environment alignment between the admin tool and the database it queries","If the user was deleted, no tier exists — remove or recreate the account as appropriate"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from uuid import UUID\nuid = UUID(user_id)  # malformed ids fail locally\n# optionally verify existence: user = await get_user_by_id(uid); assert user","typeGuard":"def is_uuid(v: str) -> TypeGuard[str]:\n    try:\n        UUID(v); return True\n    except (ValueError, TypeError):\n        return False","tryCatchPattern":"if resp.status_code == 404:\n    # no User row — confirm environment/database before reporting 'no such user'","preventionTips":["Never use truncated 12-char log prefixes as user ids","Confirm admin tool and API point at the same environment"],"tags":["http-404","user-lookup","user-id","rate-limit","tier"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}