{"record":{"id":"9cf23d3cc76c86ba","repo":"Significant-Gravitas/AutoGPT","slug":"subscription-not-available-for-tier-tier-value","errorCode":null,"errorMessage":"Subscription not available for tier {tier.value}","messagePattern":"Subscription not available for tier (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":422,"severity":"warning","filePath":"autogpt_platform/backend/backend/api/features/v1.py","lineNumber":1168,"sourceCode":"                    e,\n                )\n                raise HTTPException(\n                    status_code=502,\n                    detail=(\n                        \"Unable to cancel your subscription right now. \"\n                        \"Please try again or contact support.\"\n                    ),\n                )\n            if not had_subscription:\n                # No Stripe subscription drove this change (admin-granted or\n                # never-paid).\n                await set_subscription_tier(user_id, tier)\n            return await get_subscription_status(user_id)\n        await set_subscription_tier(user_id, tier)\n        return await get_subscription_status(user_id)\n\n    if not payment_enabled:\n        raise HTTPException(\n            status_code=422,\n            detail=f\"Subscription not available for tier {tier.value}\",\n        )\n\n    # Target has no LD price — not provisionable (matches the GET hiding).\n    if target_price_id is None:\n        raise HTTPException(\n            status_code=422,\n            detail=f\"Subscription not available for tier {tier.value}\",\n        )\n\n    # Modify in place if there's a sub; else fall through to Checkout below.\n    try:\n        modified = await modify_stripe_subscription_for_tier(\n            user_id, tier, request.billing_cycle\n        )\n        if modified:\n            return await get_subscription_status(user_id)","sourceCodeStart":1150,"sourceCodeEnd":1186,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/v1.py#L1150-L1186","documentation":"HTTP 422 from POST /credits/subscription when the ENABLE_PLATFORM_PAYMENT LaunchDarkly feature flag is off for the user. Without payments enabled, no paid tier can be provisioned, so any request targeting a paid tier is rejected. This mirrors the GET endpoint hiding paid tiers when payments are disabled.","triggerScenarios":"POST /credits/subscription with tier in {PRO, MAX, BUSINESS} while the LD flag ENABLE_PLATFORM_PAYMENT evaluates false for that user (flag off globally, or user not in the targeting).","commonSituations":"Self-hosted deployments without Stripe configured (flag intentionally off); LaunchDarkly SDK not initialized or offline so flags fall back to defaults; staging environments where payments are disabled; a specific user excluded from the flag rollout.","solutions":["Enable ENABLE_PLATFORM_PAYMENT for the user/environment in LaunchDarkly (or set the default true)","Verify the LD SDK is initialized and the SDK key is correct on the backend","Self-hosted without Stripe: do not offer paid tiers; provision tiers via admin tooling instead"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const status = await api.getSubscriptionStatus();\nif (!status.paymentEnabled) throw new Error(\"Payments not available in this environment\");","typeGuard":null,"tryCatchPattern":"try { await api.setSubscription(paidReq); }\ncatch (e) { if (e.status === 422 && /not available/.test(e.detail)) hideUpgradeUI(); else throw e; }","preventionTips":["Check subscription status/GET before showing upgrade buttons","Operators: verify ENABLE_PLATFORM_PAYMENT flag targeting","Self-hosted: expect payments disabled by default"],"tags":["feature-flag","launchdarkly","subscription","http-422"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}