{"record":{"id":"097d077ccf909b1f","repo":"passbolt/passbolt_api","slug":"could-not-retrieve-the-password-policies","errorCode":null,"errorMessage":"Could not retrieve the password policies.","messagePattern":"Could not retrieve the password policies\\.","errorType":"http","errorClass":"InternalErrorException","httpStatus":500,"severity":"error","filePath":"plugins/PassboltCe/PasswordPolicies/src/Controller/PasswordPoliciesSettingsGetController.php","lineNumber":41,"sourceCode":"use Passbolt\\PasswordPolicies\\Service\\PasswordPoliciesGetSettingsInterface;\nuse Throwable;\n\nclass PasswordPoliciesSettingsGetController extends AppController\n{\n    /**\n     * Returns passwords policies settings.\n     *\n     * @param \\Passbolt\\PasswordPolicies\\Service\\PasswordPoliciesGetSettingsInterface $passwordPoliciesGetSettingsService Service.\n     * @return void\n     */\n    public function get(PasswordPoliciesGetSettingsInterface $passwordPoliciesGetSettingsService)\n    {\n        try {\n            $passwordPoliciesSettingsDto = $passwordPoliciesGetSettingsService->get();\n            $this->success(__('The operation was successful.'), $passwordPoliciesSettingsDto->toArray());\n        } catch (Throwable $error) {\n            Log::error($error->getMessage());\n            throw new InternalErrorException(__('Could not retrieve the password policies.'));\n        }\n    }\n}\n","sourceCodeStart":23,"sourceCodeEnd":45,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/PasswordPolicies/src/Controller/PasswordPoliciesSettingsGetController.php#L23-L45","documentation":"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.","triggerScenarios":"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.","commonSituations":"Password policies never configured (nothing to get), corrupted policy payload saved by an older version, or database connectivity problems on the instance.","solutions":["Check the error log for the original Throwable message logged by the controller (Log::error).","Initialize/save password policies via POST /password-policies/settings if none exist yet.","Verify database connectivity and that migrations ran (bin/cake migrate).","If the stored payload is corrupted, fix the organization_settings row or re-save valid policies."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"$res = await fetch('/password-policies/settings'); if (!res.ok) { checkServerLogsForOriginalError(); }","typeGuard":null,"tryCatchPattern":"try { await api.getPasswordPolicies(); } catch (HttpError e) { if (e.status === 500) { // read server log for root cause } }","preventionTips":["Save password policies once before relying on GET.","Monitor server logs, since the client sees only a generic 500.","Keep database connections healthy and migrations current."],"tags":["password-policies","internal-error","settings"],"backgroundTag":"unexpected-api-response-shape","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"}