{"record":{"id":"3c623a4e114bc476","repo":"toeverything/AFFiNE","slug":"invalid-license-update-params","errorCode":"invalid_license_update_params","errorMessage":"Invalid license update params. ${reason}","messagePattern":"Invalid license update params\\. (.+?)","errorType":"exception","errorClass":"InvalidLicenseUpdateParams","httpStatus":400,"severity":"error","filePath":"packages/backend/server/src/plugins/payment/license/controller.ts","lineNumber":183,"sourceCode":"        validateKey,\n      },\n    });\n\n    res\n      .status(HttpStatus.OK)\n      .header('x-next-validate-key', validateKey)\n      .json(this.license(subscription));\n  }\n\n  @Post('/:license/seats')\n  async updateSeats(\n    @Param('license') key: string,\n    @Body() body: z.infer<typeof UpdateSeatsParams>\n  ) {\n    const parseResult = UpdateSeatsParams.safeParse(body);\n\n    if (parseResult.error) {\n      throw new InvalidLicenseUpdateParams({\n        reason: parseResult.error.message,\n      });\n    }\n\n    const license = await this.db.license.findUnique({\n      where: {\n        key,\n      },\n    });\n\n    if (!license) {\n      throw new LicenseNotFound();\n    }\n\n    await this.subscription.updateSubscriptionQuantity(\n      {\n        key: license.key,\n        plan: SubscriptionPlan.SelfHostedTeam,","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/backend/server/src/plugins/payment/license/controller.ts#L165-L201","documentation":"updateSeats validates the request body with the UpdateSeatsParams zod schema and throws InvalidLicenseUpdateParams carrying the parse error message when validation fails, keeping malformed license API requests out of the business logic.","triggerScenarios":"Thrown at packages/backend/server/src/plugins/payment/license/controller.ts:183 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the reason in the error message and correct the invalid license update parameter.","Only send supported fields when updating a license; remove unknown or malformed values.","Verify the seat count and expiry values are valid before submitting the update."],"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"}