Significant-Gravitas/AutoGPT · warning · HTTPException
Either user_id or email query parameter is required.
Error message
Either user_id or email query parameter is required.
What it means
HTTP 400 raised by _resolve_user_id when neither email nor user_id was provided on an admin rate-limit endpoint. The helper requires at least one identifier; email is optional but user_id alone is acceptable (its email is then best-effort resolved and a lookup failure never blocks).
Source
Thrown at autogpt_platform/backend/backend/api/features/admin/rate_limit_admin_routes.py:73
async def _resolve_user_id(
user_id: Optional[str], email: Optional[str]
) -> tuple[str, Optional[str]]:
"""Resolve a user_id and email from the provided parameters.
Returns (user_id, email). Accepts either user_id or email; at least one
must be provided. When both are provided, ``email`` takes precedence.
"""
if email:
user = await get_user_by_email(email)
if not user:
raise HTTPException(
status_code=404, detail="No user found with the provided email."
)
return user.id, email
if not user_id:
raise HTTPException(
status_code=400,
detail="Either user_id or email query parameter is required.",
)
# We have a user_id; try to look up their email for display purposes.
# This is non-critical -- a failure should not block the response.
try:
resolved_email = await get_user_email_by_id(user_id)
except Exception:
logger.warning("Failed to resolve email for user %s", user_id, exc_info=True)
resolved_email = None
return user_id, resolved_email
@router.get(
"/rate_limit",
response_model=UserRateLimitResponse,
summary="Get User Rate Limit",View on GitHub (pinned to 9c8bb5550f)
Solutions
- Include ?user_id=<uuid> or ?email=<address> on the request
- Check the route's OpenAPI spec for the exact query parameter names
- Ensure GET requests put identifiers in the query string, not the body
- Fail fast client-side when neither field is populated
Example fix
// before GET /api/rate_limit // after GET /api/rate_limit?user_id=883cc9da-fe37-4863-839b-acba022bf3ef
Defensive patterns
Strategy: validation
Validate before calling
if not (user_id or email):
raise ValueError("user_id or email query parameter is required")
params = {"user_id": user_id} if user_id else {"email": email} Try / catch
if resp.status_code == 400 and "required" in resp.json()["detail"]:
# missing identifier — fix parameter plumbing, don't retry as-is Prevention
- Use the OpenAPI-generated client so parameter names can't drift
- Assert at least one identifier is present before firing the request
When it happens
Trigger: Calling a rate-limit admin route with no query parameters at all, or with parameter names the backend doesn't expect (e.g. userID vs user_id), so both resolve to None/empty.
Common situations: Frontend sending the identifier in the request body on a GET route; query param renamed during a refactor and callers not updated; empty string from a form field that was never filled; OpenAPI-agnostic scripts guessing parameter names.
Related errors
- start and end query params are required
- Search query must be at least 3 characters.
- str(exc)
- str(exc)
- No user found with the provided email.
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/8cdb071e91a1d806.
Report an issue: GitHub.