{"record":{"id":"8ad82a053336c7f5","repo":"toeverything/AFFiNE","slug":"subscription-plan-not-found-8ad82a","errorCode":"subscription_plan_not_found","errorMessage":"You are trying to access a unknown subscription plan.","messagePattern":"You are trying to access a unknown subscription plan\\.","errorType":"exception","errorClass":"SubscriptionPlanNotFound","httpStatus":404,"severity":"error","filePath":"packages/backend/server/src/plugins/payment/manager/user.ts","lineNumber":128,"sourceCode":"\n    if (\n      active &&\n      !this.canCheckoutWithExistingSubscription(active.recurring, lookupKey)\n    ) {\n      throw new SubscriptionAlreadyExists({ plan: lookupKey.plan });\n    }\n\n    const customer = await this.getOrCreateCustomer(user.id);\n    const stripeSubscriptions = await this.stripe.subscriptions.list({\n      customer: customer.stripeCustomerId,\n      status: 'all',\n    });\n    this.assertNoActiveStripeSubscription(stripeSubscriptions.data, lookupKey);\n    await this.assertNoActiveRevenueCatSubscription(user.id, lookupKey);\n    const price = await this.getPrice(lookupKey);\n\n    if (!price || !(await this.isPriceAvailable(price))) {\n      throw new SubscriptionPlanNotFound({\n        plan: lookupKey.plan,\n        recurring: lookupKey.recurring,\n      });\n    }\n\n    const discounts = await (async () => {\n      if (params.coupon) {\n        const couponId = await this.getCouponFromPromotionCode(\n          params.coupon,\n          customer\n        );\n        if (couponId) {\n          return { discounts: [{ coupon: couponId }] };\n        }\n      }\n\n      return { allow_promotion_codes: true };\n    })();","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/backend/server/src/plugins/payment/manager/user.ts#L110-L146","documentation":"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.","triggerScenarios":"Thrown at packages/backend/server/src/plugins/payment/manager/user.ts:128 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a plan from the list of supported subscription plans.","Fix typos in the plan identifier passed to the payment manager.","Confirm the plan is enabled in the payment configuration."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}