toeverything/AFFiNE · error · SubscriptionPlanNotFound

subscription_plan_not_found

subscription_plan_not_found

Error message

You are trying to access a unknown subscription plan.

What it means

In user checkout, this error comes from getPrice/getVisibleSubscription internals when the lookupKey's plan cannot be resolved to a known subscription plan in the price catalogue — i.e. the requested plan does not exist for user-level checkout. The faulting input is lookupKey (plan/recurring) passed into checkout; it is a data/configuration mismatch, not an auth failure.

Source

Thrown at packages/backend/server/src/plugins/payment/manager/user.ts:128

    if (
      active &&
      !this.canCheckoutWithExistingSubscription(active.recurring, lookupKey)
    ) {
      throw new SubscriptionAlreadyExists({ plan: lookupKey.plan });
    }

    const customer = await this.getOrCreateCustomer(user.id);
    const stripeSubscriptions = await this.stripe.subscriptions.list({
      customer: customer.stripeCustomerId,
      status: 'all',
    });
    this.assertNoActiveStripeSubscription(stripeSubscriptions.data, lookupKey);
    await this.assertNoActiveRevenueCatSubscription(user.id, lookupKey);
    const price = await this.getPrice(lookupKey);

    if (!price || !(await this.isPriceAvailable(price))) {
      throw new SubscriptionPlanNotFound({
        plan: lookupKey.plan,
        recurring: lookupKey.recurring,
      });
    }

    const discounts = await (async () => {
      if (params.coupon) {
        const couponId = await this.getCouponFromPromotionCode(
          params.coupon,
          customer
        );
        if (couponId) {
          return { discounts: [{ coupon: couponId }] };
        }
      }

      return { allow_promotion_codes: true };
    })();

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Choose a plan from the list of supported subscription plans.
  2. Fix typos in the plan identifier passed to the payment manager.
  3. Confirm the plan is enabled in the payment configuration.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/backend/server/src/plugins/payment/manager/user.ts:128 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/8ad82a053336c7f5. Report an issue: GitHub.