Significant-Gravitas/AutoGPT · warning · HTTPException
Amount must be greater than or equal to 500
Error message
Amount must be greater than or equal to 500
What it means
HTTP 422 from POST /credits/auto-top-up when AutoTopUpConfig.amount is below 500 (in credit cents, i.e. 5.00) and not 0. 0 is the explicit 'disable immediate top-up / amounts don't matter' sentinel; any non-zero top-up amount must be at least the 500-cent minimum because it maps to a real Stripe charge.
Source
Thrown at autogpt_platform/backend/backend/api/features/v1.py:753
path="/credits/auto-top-up",
summary="Configure auto top up",
tags=["credits"],
dependencies=[Security(requires_user)],
)
async def configure_user_auto_top_up(
request: AutoTopUpConfig,
user_id: Annotated[str, Security(get_user_id)],
ctx: Annotated[RequestContext, Security(get_request_context)],
) -> str:
"""Configure auto top-up settings and perform an immediate top-up if needed.
Raises HTTPException(422) if the request parameters are invalid or if
the credit top-up fails.
"""
if request.threshold < 0:
raise HTTPException(status_code=422, detail="Threshold must be greater than 0")
if request.amount < 500 and request.amount != 0:
raise HTTPException(
status_code=422, detail="Amount must be greater than or equal to 500"
)
if request.amount != 0 and request.amount < request.threshold:
raise HTTPException(
status_code=422, detail="Amount must be greater than or equal to threshold"
)
credit_model = await get_credit_model(user_id, ctx.org_id)
current_balance = await credit_model.get_credits(user_id)
try:
if current_balance < request.threshold:
await credit_model.top_up_credits(user_id, request.amount)
else:
await credit_model.top_up_credits(user_id, 0)
except ValueError as e:
known_messages = (
"must not be negative",View on GitHub (pinned to 9c8bb5550f)
Solutions
- Send amount >= 500 (cents) or exactly 0 to disable immediate top-up
- Double the unit: values are integer cents, so $5.00 is 500
- Add a form hint/validation showing the minimum top-up is $5.00
Example fix
// before
{ threshold: 1000, amount: 100 }
// after
{ threshold: 1000, amount: 500 } Defensive patterns
Strategy: validation
Validate before calling
const MIN_TOP_UP = 500; // cents
if (amount !== 0 && amount < MIN_TOP_UP) throw new RangeError("amount must be 0 or >= 500 cents"); Type guard
function isValidTopUpAmount(a: unknown): a is number {
return typeof a === "number" && a >= 0 && (a === 0 || a >= 500);
} Prevention
- Remember amounts are integer cents, not dollars
- Show a $5.00 minimum hint in the UI
When it happens
Trigger: Sending {"threshold": 1000, "amount": 300} or amount: 1 in the request body; any non-zero amount under 500.
Common situations: Treating amount as dollars instead of cents (5 sent instead of 500); copying test fixtures with tiny amounts; trying to set a custom small top-up granularity; forgetting that 0 is the only allowed sub-500 value.
Related errors
- Threshold must be greater than 0
- Amount must be greater than or equal to threshold
- Page must be greater than 0
- Page size must be greater than 0
- Title must not be blank
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/7a6a668f2d35463f.
Report an issue: GitHub.