Significant-Gravitas/AutoGPT · error · HTTPException

Unable to start checkout right now. Please try again or cont

Error message

Unable to start checkout right now. Please try again or contact support.

What it means

Raised (502) when the stripe library raises stripe.StripeError while create_subscription_checkout talks to Stripe (creating a checkout session). The backend logs the full exception server-side and returns a deliberately generic message so no Stripe internals leak to the client. 502 signals the failure is with the upstream payment provider, not the request itself.

Source

Thrown at autogpt_platform/backend/backend/api/features/v1.py:1345

            detail="success_url and cancel_url must match the platform frontend origin",
        )
    try:
        url = await create_subscription_checkout(
            user_id=user_id,
            tier=tier,
            success_url=request.success_url,
            cancel_url=request.cancel_url,
            billing_cycle=request.billing_cycle,
            datafast_visitor_id=x_datafast_visitor_id,
            datafast_session_id=x_datafast_session_id,
        )
    except ValueError as e:
        raise HTTPException(status_code=422, detail=str(e))
    except stripe.StripeError as e:
        logger.exception(
            "Stripe error creating checkout session for user %s: %s", user_id, e
        )
        raise HTTPException(
            status_code=502,
            detail=(
                "Unable to start checkout right now. "
                "Please try again or contact support."
            ),
        )

    status = await get_subscription_status(user_id)
    status.url = url
    return status


def _stripe_event_dedup_key(event_id: str) -> str:
    return f"stripe_webhook_event:{event_id}"


async def _claim_stripe_event(event_id: str) -> bool:
    """Mark a Stripe webhook event as claimed via Redis SETNX.

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Retry after a short backoff — transient Stripe/network errors usually clear on their own.
  2. Check backend logs: the logger.exception line includes the exact StripeError (auth failure, invalid price, rate limit) which pinpoints the fix.
  3. Verify STRIPE_API_KEY is valid and matches the Stripe account (mode) that contains the price IDs for your tiers.
  4. If egress-restricted, allow api.stripe.com:443 from the backend container/pod.
Defensive patterns

Strategy: retry

Try / catch

catch (e) {
  if (e.response?.status === 502) {
    await sleep(backoffMs); backoffMs = Math.min(backoffMs * 2, 30_000); retries++ < 3 && retry();
  } else throw e;
}

Prevention

When it happens

Trigger: Stripe API outage or 5xx; invalid/expired STRIPE_API_KEY causing AuthenticationError; network egress blocked from the backend to api.stripe.com; rate limiting (Stripe 429) during high checkout traffic; deleted price/product IDs referenced by the tier mapping.

Common situations: Test-mode keys left in prod (or vice versa) so the configured price IDs do not exist in that Stripe account; firewall/egress rules blocking outbound HTTPS in containerized deployments; Stripe incident windows.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/3a6d0a8e8b7ab213. Report an issue: GitHub.