{"record":{"id":"9d38e0eacb7fa826","repo":"Significant-Gravitas/AutoGPT","slug":"no-user-found-with-the-provided-email","errorCode":null,"errorMessage":"No user found with the provided email.","messagePattern":"No user found with the provided email\\.","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"autogpt_platform/backend/backend/api/features/admin/rate_limit_admin_routes.py","lineNumber":67,"sourceCode":"\n\nclass SetUserTierRequest(BaseModel):\n    user_id: str\n    tier: SubscriptionTier\n\n\nasync def _resolve_user_id(\n    user_id: Optional[str], email: Optional[str]\n) -> tuple[str, Optional[str]]:\n    \"\"\"Resolve a user_id and email from the provided parameters.\n\n    Returns (user_id, email). Accepts either user_id or email; at least one\n    must be provided.  When both are provided, ``email`` takes precedence.\n    \"\"\"\n    if email:\n        user = await get_user_by_email(email)\n        if not user:\n            raise HTTPException(\n                status_code=404, detail=\"No user found with the provided email.\"\n            )\n        return user.id, email\n\n    if not user_id:\n        raise HTTPException(\n            status_code=400,\n            detail=\"Either user_id or email query parameter is required.\",\n        )\n\n    # We have a user_id; try to look up their email for display purposes.\n    # This is non-critical -- a failure should not block the response.\n    try:\n        resolved_email = await get_user_email_by_id(user_id)\n    except Exception:\n        logger.warning(\"Failed to resolve email for user %s\", user_id, exc_info=True)\n        resolved_email = None\n    return user_id, resolved_email","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/admin/rate_limit_admin_routes.py#L49-L85","documentation":"HTTP 404 raised by the rate-limit admin helper _resolve_user_id when an email query parameter was supplied but get_user_by_email(email) returned no user. It fires before any rate-limit operation runs, and email takes precedence over user_id when both are given.","triggerScenarios":"Calling an admin rate-limit endpoint (e.g. GET usage or POST reset) with ?email=... where the email has no User row in the database: typo'd address, unregistered user, wrong environment's database, or mixed-case/whitespace differences.","commonSituations":"Typo in the email (trailing spaces, '.con'); the target user exists in production but the admin tool points at a staging database; users who signed up via OAuth with a different canonical email; casing mismatch after email normalization changes.","solutions":["Confirm the exact email in the User table (query Supabase/Prisma for the user)","Trim whitespace and verify casing against the stored value","If both email and user_id are known, pass the user_id to bypass email lookup","Check you're connected to the correct environment's database"],"exampleFix":"// before\nGET /api/rate_limit?email=jane.doe%20@example.com\n// after\nGET /api/rate_limit?email=jane.doe@example.com","handlingStrategy":"validation","validationCode":"email = email.strip().lower()\nassert email and \"@\" in email\n# Prefer user_id when available to skip email lookup entirely","typeGuard":null,"tryCatchPattern":"if resp.status_code == 404 and email_param:\n    # email not found — verify spelling/environment before retry","preventionTips":["Trim and normalize emails before sending","Prefer user_id over email for automated tooling","Verify the user exists in the target environment's DB first"],"tags":["http-404","user-lookup","email","rate-limit","admin"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}