hcengineering/platform · error
Missing productIds for plan: ${planKey}
Error message
Missing productIds for plan: ${planKey} What it means
The Polar payment provider maps a subscription request (type + plan) to a configured set of Polar product IDs via getPlanKey and this.subscriptionPlans. If the computed planKey has no entry in subscriptionPlans, the provider cannot create a checkout and throws 'Missing productIds for plan: <planKey>'. It indicates the deployment's Polar plan configuration is missing that tier/plan combination.
Source
Thrown at services/payment/pod-payment/src/providers/polar/provider.ts:104
if (this.subscriptionPlans[plan] === undefined) {
throw new Error(`Missing plan in config: ${plan}`)
}
}
}
async createSubscription (
ctx: MeasureContext,
request: SubscribeRequest,
workspaceUuid: WorkspaceUuid,
workspaceUrl: string,
accountUuid: string
): Promise<CheckoutResponse> {
ctx.info('Creating Polar subscription', { type: request.type, plan: request.plan })
const planKey = getPlanKey(request.type, request.plan)
const productIds = this.subscriptionPlans[planKey]
if (productIds === undefined) {
throw new Error(`Missing productIds for plan: ${planKey}`)
}
const successUrl = `${this.frontUrl}/workbench/${workspaceUrl}/setting/setting/billing/subscriptions?payment=success&checkout_id={CHECKOUT_ID}`
const returnUrl = `${this.frontUrl}/workbench/${workspaceUrl}/setting/setting/billing/subscriptions?payment=canceled`
const response = await this.polar.createCheckout(ctx, {
productIds,
successUrl,
returnUrl,
externalCustomerId: accountUuid,
customerEmail: request.customerEmail,
customerName: request.customerName,
metadata: {
workspaceUuid,
subscriptionType: request.type,
subscriptionPlan: request.plan
}
})
return {View on GitHub (pinned to 63e28dc964)
Solutions
- Add the missing planKey -> Polar productIds entry to the provider's subscriptionPlans configuration and redeploy
- Check the exact planKey value in the error message and fix the caller to send a supported plan/type combination
- Align getPlanKey with the configured keys after any type/plan rename
- Verify against the Polar dashboard that product IDs exist for that plan
Example fix
// before
subscriptionPlans: { 'tier:free': ['prod_free'], 'tier:team': ['prod_team'] }
// request plan 'enterprise' -> throw
// after
subscriptionPlans: { 'tier:free': ['prod_free'], 'tier:team': ['prod_team'], 'tier:enterprise': ['prod_ent'] } Defensive patterns
Strategy: validation
Validate before calling
const planKey = getPlanKey(request.type, request.plan)
if (provider.subscriptionPlans?.[planKey] === undefined) {
throw new Error(`Plan ${planKey} is not available; choose one of ${Object.keys(provider.subscriptionPlans ?? {}).join(', ')}`)
} Type guard
function isConfiguredPlan(provider: PolarProvider, planKey: string): planKey is keyof typeof provider.subscriptionPlans {
return provider.subscriptionPlans?.[planKey] !== undefined
} Try / catch
try {
await provider.createSubscription(ctx, request)
} catch (e) {
if (e.message.startsWith('Missing productIds for plan')) {
// surface 400 'plan not available' to the client
} else throw e
} Prevention
- Keep subscriptionPlans config in sync with the plans advertised in the billing UI
- Expose the list of available plans via an API and validate against it client-side
- Add a startup/unit test that every advertised plan key has product IDs
- Grep the error planKey against config on occurrence
When it happens
Trigger: createSubscription invoked with a request.type/request.plan whose getPlanKey(result) is absent from this.subscriptionPlans — e.g. plan 'enterprise' when only 'free'|'starter'|'team' are configured, or type 'Tier' vs a map keyed for 'Vendor' plans.
Common situations: New plan added to product UI before Polar provider config (env/JSON subscriptionPlans) was updated; typo in plan name from the client; mismatch between plan keys after a rename/refactor; regional deployments with different plan catalogs.
Related errors
- No products configured for plan: ${planKey}
- Payment service URL not specified
- Authentication token not specified
- Failed to cancel subscription ${providerSubscriptionId}
- Failed to uncancel subscription ${providerSubscriptionId}
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/c93f2d6a20a17ee5.
Report an issue: GitHub.