Significant-Gravitas/AutoGPT · error · HTTPException
Insufficient balance of ${current_balance / 100}, where this
Error message
Insufficient balance of ${current_balance / 100}, where this will cost ${abs(amount) / 100} What it means
HTTP 402 raised by POST /blocks/{block_id}/execute when the user's credit balance is too low to pay for a direct (graph-less) block execution. execution_utils.charge_for_block_execution raises InsufficientBalanceError (a ValueError subclass in backend/util/exceptions.py), and the route maps it to 402 PAYMENT_REQUIRED. The detail message reports current balance and estimated cost, both divided by 100 because credits are stored as integer cents.
Source
Thrown at autogpt_platform/backend/backend/api/features/v1.py:536
user_id: Annotated[str, Security(get_user_id)],
ctx: Annotated[RequestContext, Security(get_request_context)],
) -> CompletedBlockOutput:
obj = get_block(block_id)
if not obj:
raise HTTPException(status_code=404, detail=f"Block #{block_id} not found.")
if obj.disabled:
raise HTTPException(status_code=403, detail=f"Block #{block_id} is disabled.")
user = await get_user_by_id(user_id)
if not user:
raise HTTPException(status_code=404, detail="User not found.")
try:
await execution_utils.charge_for_direct_block_execution(
user_id=user_id, block=obj, input_data=data, source="internal"
)
except InsufficientBalanceError as e:
raise HTTPException(status_code=HTTP_402_PAYMENT_REQUIRED, detail=str(e)) from e
# Direct block execution has no graph; build a minimal ExecutionContext
# carrying the caller's identity + timezone so blocks that depend on
# those (e.g. time blocks) get correct data.
execution_context = ExecutionContext(
user_id=user_id,
user_timezone=get_user_timezone_or_utc(user.timezone),
)
start_time = time.time()
try:
output = defaultdict(list)
async for name, data in obj.execute(
data,
user_id=user_id,
execution_context=execution_context,
):
output[name].append(data)View on GitHub (pinned to 9c8bb5550f)
Solutions
- Top up credits via the billing/credits endpoint (POST /credits) or buy a subscription, then retry the execution
- Enable auto top-up (POST /credits/auto-top-up) with a threshold above the typical cost of the blocks you run
- Pick a cheaper block configuration/model so the execution cost fits the remaining balance
- If you administer the platform: grant credits via grant_credits()/admin tooling for beta testers or refunds
Example fix
// before
const res = await fetch(`/api/v1/blocks/${blockId}/execute`, {...});
// 402 {detail: "Insufficient balance of 0.5, where this will cost 2.0"}
// after
if (res.status === 402) {
await topUpCredits();
return retryExecute(blockId, input);
} Defensive patterns
Strategy: validation
Validate before calling
const balance = (await api.getCredits()).balance; // cents
const estimated = await api.estimateBlockCost(blockId, input); // if available
if (estimated > balance) {
await topUpOrPromptUser(estimated - balance);
} Try / catch
try {
const res = await fetch(`/api/v1/blocks/${blockId}/execute`, opts);
if (res.status === 402) { /* prompt top-up, enable auto-top-up */ }
} catch (e) { /* network error only */ } Prevention
- Keep auto top-up enabled with a threshold above typical block cost
- Check GET /credits before running expensive blocks
- Prefer cheaper models for exploratory runs
When it happens
Trigger: Calling the direct block execution endpoint (e.g. POST /api/v1/blocks/{block_id}/execute) with an input that makes the block's computed execution cost exceed the user's current credit balance; e.g. an LLM block with an expensive model selected, or a large input, while the user's balance is near zero.
Common situations: New accounts with only the sign-up grace credits; auto-top-up not configured or its threshold set too low; long-running sessions that drained credits; running expensive models (e.g. premium LLM slugs) with a minimal balance; test environments where the credit table was seeded with 0.
Related errors
- str(e)
- Rate limit reset is not available (credit system is disabled
- Insufficient credits to reset your rate limit.
- str(e)
- Insufficient balance to execute the agent. Please top up you
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/90b7353b0baaabda.
Report an issue: GitHub.