toeverything/AFFiNE · error · InvalidLicenseUpdateParams

invalid_license_update_params

invalid_license_update_params

Error message

Invalid license update params. ${reason}

What it means

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.

Source

Thrown at packages/backend/server/src/plugins/payment/license/controller.ts:183

        validateKey,
      },
    });

    res
      .status(HttpStatus.OK)
      .header('x-next-validate-key', validateKey)
      .json(this.license(subscription));
  }

  @Post('/:license/seats')
  async updateSeats(
    @Param('license') key: string,
    @Body() body: z.infer<typeof UpdateSeatsParams>
  ) {
    const parseResult = UpdateSeatsParams.safeParse(body);

    if (parseResult.error) {
      throw new InvalidLicenseUpdateParams({
        reason: parseResult.error.message,
      });
    }

    const license = await this.db.license.findUnique({
      where: {
        key,
      },
    });

    if (!license) {
      throw new LicenseNotFound();
    }

    await this.subscription.updateSubscriptionQuantity(
      {
        key: license.key,
        plan: SubscriptionPlan.SelfHostedTeam,

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Read the reason in the error message and correct the invalid license update parameter.
  2. Only send supported fields when updating a license; remove unknown or malformed values.
  3. Verify the seat count and expiry values are valid before submitting the update.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/backend/server/src/plugins/payment/license/controller.ts:183 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/3c623a4e114bc476. Report an issue: GitHub.