{"record":{"id":"4af237ade2e4a0ce","repo":"passbolt/passbolt_api","slug":"account-recovery-reason-not-supported","errorCode":null,"errorMessage":"Account recovery reason not supported.","messagePattern":"Account recovery reason not supported\\.","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"src/Service/Users/UserRecoverService.php","lineNumber":140,"sourceCode":"            ->setLayout('default')\n            ->setTemplate('triage');\n    }\n\n    /**\n     * @return string self::ACCOUNT_RECOVERY_CASE_DEFAULT default\n     */\n    protected function assertRecoveryCase(): string\n    {\n        $case = $this->request->getData('case') ?? null;\n\n        if (!isset($case)) {\n            return self::ACCOUNT_RECOVERY_CASE_DEFAULT;\n        }\n        if (!is_string($case)) {\n            throw new BadRequestException(__('Account recovery case must be a string.'));\n        }\n        if (!in_array($case, self::ACCOUNT_RECOVERY_CASES)) {\n            throw new BadRequestException(__('Account recovery reason not supported.'));\n        }\n\n        return $case;\n    }\n\n    /**\n     * Assert some username data is provided\n     *\n     * @throws \\Cake\\Http\\Exception\\BadRequestException if the username is not valid\n     * @throws \\Cake\\Http\\Exception\\BadRequestException if the username is not provided\n     * @return string validated username\n     */\n    protected function assertUsername(): string\n    {\n        $username = $this->request->getData('username') ?? null;\n        if (!isset($username) || !is_string($username) || !EmailValidationRule::check($username)) {\n            throw new BadRequestException(__('Please provide a valid email address.'));\n        }","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/src/Service/Users/UserRecoverService.php#L122-L158","documentation":"Thrown by UserRecoverService::assertRecoveryCase when the 'case' field is a string but is not one of the values in ACCOUNT_RECOVERY_CASES. Only specific recovery reasons ('default', 'lost-token', etc.) are accepted; any other string is rejected with this message.","triggerScenarios":"POST /recover.json with {\"username\": \"u@x.com\", \"case\": \"forgot-password\"} or any misspelled/unimplemented case value.","commonSituations":"Typos in the case value (e.g. 'lostpassword' vs 'lost-token'); API version drift where a case name was renamed or added in a newer passbolt version; docs from a different version or from the Pro edition listing cases unavailable in CE.","solutions":["Check the exact allowed values in UserRecoverService::ACCOUNT_RECOVERY_CASES and send one verbatim.","Fix typos — values are exact string matches, e.g. \"lost-token\" not \"lost token\".","If you don't need a specific case, omit the field (defaults are applied).","Verify your passbolt version supports the case you're sending (Pro-only or newer-release cases are rejected on older/CE servers)."],"exampleFix":"// before\n{\"username\":\"u@x.com\",\"case\":\"password-reset\"}\n\n// after\n{\"username\":\"u@x.com\",\"case\":\"lost-token\"}","handlingStrategy":"validation","validationCode":"const ALLOWED_CASES = ['default', 'lost-token', 'lost-passphrase', 'mfa-reset']; // per your server version's ACCOUNT_RECOVERY_CASES\nif (body.case !== undefined && !ALLOWED_CASES.includes(body.case)) {\n  throw new Error(`Unsupported recovery case: ${body.case}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await recover(body);\n} catch (e) {\n  if (e.response?.body?.message?.includes('reason not supported')) {\n    console.error(`Unknown case \"${body.case}\"; use one of the documented values or omit it.`);\n  }\n}","preventionTips":["Copy case values verbatim from your server version's UserRecoverService::ACCOUNT_RECOVERY_CASES.","Centralize the case strings as constants in your client instead of inlining literals.","Pin client docs/tests to the passbolt version you deploy — case names can differ across versions and editions."],"tags":["passbolt","account-recovery","bad-request","invalid-enum"],"backgroundTag":"invalid-enum-value","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"}