{"record":{"id":"f479820b9278dc0a","repo":"toeverything/AFFiNE","slug":"invalid-checkout-parameters","errorCode":"invalid_checkout_parameters","errorMessage":"Invalid checkout parameters provided.","messagePattern":"Invalid checkout parameters provided\\.","errorType":"exception","errorClass":"InvalidCheckoutParameters","httpStatus":400,"severity":"error","filePath":"packages/backend/server/src/plugins/payment/manager/user.ts","lineNumber":99,"sourceCode":"      if (await this.isPriceAvailable(price)) {\n        availablePrices.push(price);\n      }\n    }\n\n    return availablePrices;\n  }\n\n  async checkout(\n    lookupKey: LookupKey,\n    params: z.infer<typeof CheckoutParams>,\n    { user }: z.infer<typeof UserSubscriptionCheckoutArgs>\n  ) {\n    if (\n      (lookupKey.plan !== SubscriptionPlan.Pro &&\n        lookupKey.plan !== SubscriptionPlan.AI) ||\n      lookupKey.variant !== null\n    ) {\n      throw new InvalidCheckoutParameters();\n    }\n\n    const active = await this.getVisibleSubscription({\n      plan: lookupKey.plan,\n      userId: user.id,\n    });\n    await this.assertNoActiveLocalEntitlement(user.id, lookupKey);\n    if (active?.provider === 'revenuecat') {\n      throw new ManagedByAppStoreOrPlay();\n    }\n\n    if (\n      active &&\n      !this.canCheckoutWithExistingSubscription(active.recurring, lookupKey)\n    ) {\n      throw new SubscriptionAlreadyExists({ plan: lookupKey.plan });\n    }\n","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/backend/server/src/plugins/payment/manager/user.ts#L81-L117","documentation":"An InvalidCheckoutParameters sentinel at the start of user subscription checkout: it fires when lookupKey names a plan other than Pro or AI, or when lookupKey.variant is non-null. These are the only individually purchasable user plans, so any other plan/variant combination is rejected before subscription or Stripe calls are made; the faulting input is the lookupKey passed to checkout.","triggerScenarios":"Thrown at packages/backend/server/src/plugins/payment/manager/user.ts:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a valid plan and recurring interval in the checkout request.","Remove unsupported parameters and ensure required fields are present.","Compare the request payload against the checkout API schema and fix mismatches."],"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"}