passbolt/passbolt_api · error · SubscriptionRecordNotFoundException

Subscription key could not be found.

Error message

Subscription key could not be found.

What it means

SubscriptionKeyGetService::get() reads the subscription key from the database (readFromDB) and falls back to the config file (readFromFile). If neither exists or the value is empty, it throws SubscriptionRecordNotFoundException. It means no valid subscription key has ever been imported or saved on this instance.

Solutions

  1. Import a valid subscription key (admin UI, CLI import command, or importFromFile)
  2. Verify the subscription key file path configuration points to the correct file
  3. Check the subscriptions table (and file storage) for an existing key and restore it from backup

Example fix

// before
const dto = await getService.get(uac); // throws if absent
// after
try {
  const dto = await getService.get(uac);
} catch (e) {
  if (e instanceof SubscriptionRecordNotFoundException) promptLicenseImport();
}
Defensive patterns

Strategy: try-catch

Validate before calling

// server-side guard before get()
$exists = $this->SubscriptionsTable->exists([]) || file_exists($keyFilePath);

Type guard

null

Try / catch

try { $dto = $service->get($uac); } catch (SubscriptionRecordNotFoundException $e) { // prompt license import }

Prevention

When it happens

Trigger: GET subscription key when the subscriptions table has no row and no subscription key file is present, or when the stored key string is empty.

Common situations: Fresh Passbolt EE installs where the license was never imported; the config key file was deleted or the config/keys path is wrong; database migration wiped the subscriptions table.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/7c84094118a8953f. Report an issue: GitHub.

Appendix: source

Thrown at plugins/PassboltEe/Subscription/src/Service/Subscriptions/SubscriptionKeyGetService.php:70

        $this->Subscriptions = $this->fetchTable('Passbolt/Subscription.Subscriptions');
        $this->SubscriptionValidateService = new SubscriptionKeyValidateService();
    }

    /**
     * @param \App\Utility\UserAccessControl $uac user access control object
     * @return \Passbolt\Subscription\Model\Dto\SubscriptionKeyDto
     */
    public function get(UserAccessControl $uac): SubscriptionKeyDto
    {
        if (!$uac->isAdmin()) {
            throw new ForbiddenException(__('Only administrators can view the subscription details.'));
        }
        $keyString = $this->readFromDB();
        if (!isset($keyString)) {
            $keyString = $this->readFromFile();
        }
        if (!isset($keyString) || empty($keyString)) {
            throw new SubscriptionRecordNotFoundException();
        }

        return $this->SubscriptionValidateService->validate($keyString);
    }

    /**
     * Try to read the key string from database (OrganizationSettings table)
     * Try new file name first then legacy name, log warnings if issues.
     *
     * @return string|null
     * @throws \Passbolt\Subscription\Error\Exception\Subscriptions\SubscriptionException if subscription key is invalid
     */
    protected function readFromDB(): ?string
    {
        try {
            return $this->Subscriptions->getOrFail()->get('value');
        } catch (SubscriptionRecordNotFoundException $exception) {
            Log::warning('The subscription key could not be found in the database. Falling back on files.');

View on GitHub (pinned to 31c1bbc10f)