Significant-Gravitas/AutoGPT · warning · HTTPException
Amount must be greater than or equal to threshold
Error message
Amount must be greater than or equal to threshold
What it means
HTTP 422 from POST /credits/auto-top-up when a non-zero amount is smaller than the configured threshold. Auto top-up exists to restore the balance above the trigger level; topping up by less than the threshold would immediately re-trigger, so the route rejects it up front.
Source
Thrown at autogpt_platform/backend/backend/api/features/v1.py:757
)
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",
"already exists for user",
"No payment method found",
)
if any(msg in str(e) for msg in known_messages):View on GitHub (pinned to 9c8bb5550f)
Solutions
- Set amount >= threshold (both non-zero), e.g. threshold 1000 / amount 1500
- Use amount = 0 if you only want to record the threshold without an immediate top-up
Example fix
// before
{ threshold: 2000, amount: 1000 }
// after
{ threshold: 2000, amount: 2500 } Defensive patterns
Strategy: validation
Validate before calling
if (amount !== 0 && amount < threshold) throw new RangeError("amount must be >= threshold"); Prevention
- Update amount and threshold together in the form
- When raising the threshold, re-check the amount field
When it happens
Trigger: Sending e.g. {"threshold": 2000, "amount": 1000} where both pass the minimum-500 rule but amount < threshold.
Common situations: Raising the threshold without raising the amount; thinking amount is the remaining-balance target rather than the increment; stale frontend state after editing threshold first.
Related errors
- Threshold must be greater than 0
- Amount must be greater than or equal to 500
- 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/b0eb12143d251bac.
Report an issue: GitHub.