passbolt/passbolt_api · error · InternalErrorException

Could not retrieve the password policies.

Error message

Could not retrieve the password policies.

What it means

InternalErrorException thrown by PasswordPoliciesSettingsGetController::get when the underlying PasswordPoliciesGetSettingsService::get() throws any Throwable. The original error is logged, and a generic 500 is returned to the client.

Solutions

  1. Check the error log for the original Throwable message logged by the controller (Log::error).
  2. Initialize/save password policies via POST /password-policies/settings if none exist yet.
  3. Verify database connectivity and that migrations ran (bin/cake migrate).
  4. If the stored payload is corrupted, fix the organization_settings row or re-save valid policies.
Defensive patterns

Strategy: try-catch

Validate before calling

$res = await fetch('/password-policies/settings'); if (!res.ok) { checkServerLogsForOriginalError(); }

Try / catch

try { await api.getPasswordPolicies(); } catch (HttpError e) { if (e.status === 500) { // read server log for root cause } }

Prevention

When it happens

Trigger: GET /password-policies/settings when the service throws — e.g. no saved policies record found, malformed stored policy JSON, or a database error while reading organization settings.

Common situations: Password policies never configured (nothing to get), corrupted policy payload saved by an older version, or database connectivity problems on the instance.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at plugins/PassboltCe/PasswordPolicies/src/Controller/PasswordPoliciesSettingsGetController.php:41

use Passbolt\PasswordPolicies\Service\PasswordPoliciesGetSettingsInterface;
use Throwable;

class PasswordPoliciesSettingsGetController extends AppController
{
    /**
     * Returns passwords policies settings.
     *
     * @param \Passbolt\PasswordPolicies\Service\PasswordPoliciesGetSettingsInterface $passwordPoliciesGetSettingsService Service.
     * @return void
     */
    public function get(PasswordPoliciesGetSettingsInterface $passwordPoliciesGetSettingsService)
    {
        try {
            $passwordPoliciesSettingsDto = $passwordPoliciesGetSettingsService->get();
            $this->success(__('The operation was successful.'), $passwordPoliciesSettingsDto->toArray());
        } catch (Throwable $error) {
            Log::error($error->getMessage());
            throw new InternalErrorException(__('Could not retrieve the password policies.'));
        }
    }
}

View on GitHub (pinned to 31c1bbc10f)