Significant-Gravitas/AutoGPT · error · HTTPException

Payment redirect URLs cannot be validated: frontend_base_url

Error message

Payment redirect URLs cannot be validated: frontend_base_url or platform_base_url must be set on the server.

What it means

Raised (503) by the update_subscription_tier checkout endpoint when neither settings.config.frontend_base_url nor settings.config.platform_base_url is set. The server refuses to create Stripe checkout sessions because success_url/cancel_url validation against an allow-list of origins is impossible without a configured base URL, and proceeding would allow redirecting users to arbitrary phishing sites. It is a deliberate fail-fast guard so operators get an actionable 503 instead of a misleading 422.

Source

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

        raise HTTPException(
            status_code=422,
            detail="success_url and cancel_url are required for paid tier upgrades",
        )
    # Open-redirect protection: both URLs must point to the configured frontend
    # origin, otherwise an attacker could use our Stripe integration as a
    # redirector to arbitrary phishing sites.
    #
    # Fail early with a clear 503 if the server is misconfigured (neither
    # frontend_base_url nor platform_base_url set), so operators get an
    # actionable error instead of the misleading "must match the platform
    # frontend origin" 422 that _validate_checkout_redirect_url would otherwise
    # produce when `allowed` is empty.
    if not (settings.config.frontend_base_url or settings.config.platform_base_url):
        logger.error(
            "update_subscription_tier: neither frontend_base_url nor "
            "platform_base_url is configured; cannot validate checkout redirect URLs"
        )
        raise HTTPException(
            status_code=503,
            detail=(
                "Payment redirect URLs cannot be validated: "
                "frontend_base_url or platform_base_url must be set on the server."
            ),
        )
    if not _validate_checkout_redirect_url(
        request.success_url
    ) or not _validate_checkout_redirect_url(request.cancel_url):
        raise HTTPException(
            status_code=422,
            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,

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Set frontend_base_url (or platform_base_url) in the backend configuration (env var / .env / App config) to the origin the frontend is served from, e.g. PLATFORM_BASE_URL=https://app.example.com, then restart the backend.
  2. Verify with a health/config dump or by checking process env that the running server actually sees the variable (not just your shell).
  3. If you intentionally run payments-disabled, block or stub the subscription route at the gateway so clients get a clearer 'payments unavailable' signal.

Example fix

# before (backend .env missing both)
# (no base URL configured -> 503 on checkout)

# after
FRONTEND_BASE_URL=http://localhost:3000
# or
PLATFORM_BASE_URL=https://app.example.com
Defensive patterns

Strategy: validation

Validate before calling

// before calling the tier-upgrade endpoint
const health = await fetch('/health').then(r => r.json());
if (!health.config?.frontend_base_url && !health.config?.platform_base_url) {
  showBanner('Payments are not configured on this server.');
}

Try / catch

try { await api.updateSubscriptionTier(...) } catch (e) { if (e.response?.status === 503 && /frontend_base_url|platform_base_url/.test(e.response.data.detail)) { reportServerMisconfiguration(); } else { throw e; } }

Prevention

When it happens

Trigger: POST to /credits/checkout-style subscription tier upgrade endpoint (update_subscription_tier) while the backend process has both frontend_base_url and platform_base_url empty/unset in its AppConfiguration — e.g. a fresh deployment, local dev without .env, or a staging server missing PLATFORM_BASE_URL/FRONTEND_BASE_URL env vars.

Common situations: New environment bootstrap where .env was copied incompletely; docker-compose started without the platform_base_url variable; CI/smoke tests hitting the payments endpoint on a bare config; renaming or removing the env var during config refactors.

Related errors


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