Significant-Gravitas/AutoGPT · error · HTTPException
Your card was declined. The plan was not changed; please upd
Error message
Your card was declined. The plan was not changed; please update your payment method and try again.
What it means
HTTP 402 raised when the subscription modify auto-charge fails with a Stripe CardError that is NOT an SCA code - i.e. a hard decline (card_declined, insufficient_funds, expired_card, etc.). error_if_incomplete guarantees the modify was rolled back, so the plan is unchanged and the user must fix the payment method and retry.
Source
Thrown at autogpt_platform/backend/backend/api/features/v1.py:1216
"authentication_required",
"subscription_payment_intent_requires_action",
}:
logger.warning(
"SCA required on subscription upgrade for user %s: %s", user_id, e
)
raise HTTPException(
status_code=402,
detail=(
"Your bank requires extra authentication for this charge."
" The plan was not changed; please retry from the billing"
" portal so you can complete authentication, or contact"
" support."
),
)
logger.warning(
"Card declined on subscription upgrade for user %s: %s", user_id, e
)
raise HTTPException(
status_code=402,
detail=(
"Your card was declined. The plan was not changed; please"
" update your payment method and try again."
),
)
except stripe.InvalidRequestError as e:
# Stripe's e.param is documented as nullable, so we match by typed
# field first and fall back to substring when param is absent.
msg_lower = (e.user_message or str(e)).lower()
# "No payment method" presents as InvalidRequestError (not CardError)
# when error_if_incomplete fires with no default PM. Stripe signals
# this with code=resource_missing/missing — sometimes with a typed
# param, sometimes without (the raw "no attached payment source"
# message has empty param). Map it to 402 either way.
if e.code in {"resource_missing", "missing"} and (
e.param
in {View on GitHub (pinned to 9c8bb5550f)
Solutions
- Update the payment method (add a valid card) in the billing portal, then retry the upgrade
- Check for sufficient funds / contact the issuing bank if declines persist
- Verify you are using Stripe test cards only against test-mode keys
Defensive patterns
Strategy: try-catch
Try / catch
try { await api.setSubscription(req); }
catch (e) {
if (e.status === 402 && /declined/.test(e.detail)) promptUpdateCard();
else throw e;
} Prevention
- Prompt for a new card on the declined message instead of retrying
- Pre-validate cards with a small setup-intent flow where possible
When it happens
Trigger: Upgrading a tier with an expired card, a card with insufficient funds, or a card the issuer outright declines.
Common situations: Expired/replace card still set as default; insufficient credit limit; issuer fraud blocks on unexpected charges; test cards like 4000000000000002 in non-test mode.
Related errors
- No payment method on file. The plan was not changed; please
- Unable to cancel the pending subscription change right now.
- Unable to cancel your subscription right now. Please try aga
- Tier change unavailable for your current billing currency. P
- Unable to update your subscription right now. Please try aga
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/80e17e622bfe56dc.
Report an issue: GitHub.