{"record":{"id":"f7d1db81f640ec30","repo":"passbolt/passbolt_api","slug":"password-expiry-is-not-activated-f7d1db","errorCode":null,"errorMessage":"Password expiry is not activated.","messagePattern":"Password expiry is not activated\\.","errorType":"console","errorClass":"StopException","httpStatus":null,"severity":"warning","filePath":"plugins/PassboltEe/PasswordExpiryPolicies/src/Service/Resources/PasswordExpiryPoliciesGetOwnersOfResourcesAboutToExpireService.php","lineNumber":62,"sourceCode":"     * @param \\Passbolt\\PasswordExpiry\\Service\\Settings\\PasswordExpiryGetSettingsServiceInterface $settingsService Get password expiry service\n     */\n    public function __construct(PasswordExpiryGetSettingsServiceInterface $settingsService)\n    {\n        $this->settingsService = $settingsService;\n    }\n\n    /**\n     * Notify the users about their passwords expiring today or in N days\n     *\n     * @return \\Cake\\ORM\\Query\n     * @throws \\Cake\\Console\\Exception\\StopException if the settings are not enabled\n     */\n    public function notifyUsers(): Query\n    {\n        $settings = $this->settingsService->get();\n\n        if (!$settings->isPasswordExpiryFeatureEnabled()) {\n            throw new StopException(__('Password expiry is not activated.'));\n        }\n\n        // Notify resource owners that some resources are about to expire\n        $expiryNotificationInDays = EmailNotificationSettings::get('send.password.aboutToExpire') ?\n            $settings->getExpiryNotification() : null;\n\n        // Notify resource owners that resources are expiring today\n        $notifyIfExpiresToday = (bool)EmailNotificationSettings::get('send.password.expire');\n\n        $users = $this->getUsersToNotify($expiryNotificationInDays, $notifyIfExpiresToday);\n        $users\n            ->find('locale')\n            ->contain(['Profiles' => AvatarsTable::addContainAvatar()]);\n\n        $this->dispatchEvent(\n            self::NOTIFY_ABOUT_EXPIRED_RESOURCES_EVENT_NAME,\n            [\n                'users' => $users->all()->toArray(),","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/PasswordExpiryPolicies/src/Service/Resources/PasswordExpiryPoliciesGetOwnersOfResourcesAboutToExpireService.php#L44-L80","documentation":"PasswordExpiryPoliciesGetOwnersOfResourcesAboutToExpireService::notifyUsers() first loads password expiry settings and requires the 'expired' (password expiry) feature to be enabled. When isPasswordExpiryFeatureEnabled() is false it throws StopException, since notifying about expiring resources is meaningless with expiry disabled.","triggerScenarios":"Running the notify/expiry-email job (e.g. 'passbolt notify_user_of_resources_expiring' style command or scheduled email digest) when the passwordExpiry disabled setting is true (or absent and defaulting to disabled) in password_expiry_settings.","commonSituations":"EE Password Expiry feature not purchased/enabled but a cron job still triggers the notification; settings table lacking the 'disabled'=>false entry after migration.","solutions":["Enable password expiry via the admin UI or the password expiry policies settings endpoint so isPasswordExpiryFeatureEnabled() returns true","Remove/disable the scheduled job that calls notifyUsers() if the feature is intentionally off","Check the password_expiry_settings table contains an enabled configuration and run the migration if the table is missing"],"exampleFix":"// before\n// no password_expiry_settings row -> feature considered disabled, cron still runs\n// after\nbin/cake passbolt password_expiry_policies enable  # or set {\"disabled\":false} via settings API before scheduling notifications","handlingStrategy":"validation","validationCode":"$settings = (new PasswordExpiryPoliciesGetSettingsService())->get();\nif (!$settings->isPasswordExpiryFeatureEnabled()) {\n    // skip notify job\n    return;\n}","typeGuard":"$featureEnabled = $settings !== null && $settings->isPasswordExpiryFeatureEnabled();","tryCatchPattern":"try {\n    $owners = $service->notifyUsers();\n} catch (StopException $e) {\n    if ($e->getMessage() === 'Password expiry is not activated.') {\n        // disable the job or enable the feature\n    }\n}","preventionTips":["Align cron jobs with purchased/enabled EE features","Gate scheduled notification tasks on the feature flag","Verify password_expiry_settings after migrations or plan changes"],"tags":["password-expiry","feature-flag","cron","settings"],"backgroundTag":"feature-not-enabled","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}