{"record":{"id":"f3b43112f2ef041d","repo":"nextcloud/all-in-one","slug":"unexpected-response-from-desec-during-account-regi","errorCode":null,"errorMessage":"Unexpected response from deSEC during account registration (HTTP {code}): {body}","messagePattern":"Unexpected response from deSEC during account registration \\(HTTP (.+?)\\): (.+?)","errorType":"exception","errorClass":"\\Exception","httpStatus":422,"severity":"error","filePath":"php/src/Desec/DesecManager.php","lineNumber":206,"sourceCode":"     * (without sending a mail), so a 202 cannot be treated as proof of a new account.\n     * The captcha field is omitted; deSEC requires it only at email-verification time,\n     * which the user completes in the browser via the emailed link.\n     *\n     * @throws \\Exception on network failure or an unexpected HTTP response\n     */\n    public function registerAccount(string $email, string $password): void {\n        try {\n            $res = $this->guzzleClient->post($this->configurationManager->desecApiBase . '/auth/', [\n                'json' => ['email' => $email, 'password' => $password],\n            ]);\n        } catch (TransferException $e) {\n            throw new \\Exception('Could not reach the deSEC API: ' . $e->getMessage());\n        }\n\n        $code = $res->getStatusCode();\n\n        if ($code !== 202) {\n            throw new \\Exception('Unexpected response from deSEC during account registration (HTTP ' . $code . '): ' . $res->getBody()->getContents());\n        }\n    }\n\n    /**\n     * Attempts to log in after the user was asked to verify a freshly created account.\n     *\n     * A login failure here has two common causes that we cannot tell apart, because\n     * deSEC returns 202 both for a genuinely new account and for one whose email was\n     * already registered (to prevent email enumeration):\n     *   1. The account is new but its email has not been verified yet.\n     *   2. The email already belonged to an existing deSEC account, so no new account\n     *      (and no verification mail) was created and our generated password is wrong.\n     * The message covers both and points to the fix for each.\n     *\n     * @throws \\Exception with a friendly hint when login is not yet possible\n     */\n    private function loginAfterVerification(string $email, string $password): string {\n        try {","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/nextcloud/all-in-one/blob/6b788eec5e61733cf03ed380a3572e43ae3f11ce/php/src/Desec/DesecManager.php#L188-L224","documentation":"Thrown by DesecManager::registerAccount after POSTing {email, password} to the deSEC /auth/ endpoint when the HTTP status is anything other than 202 Accepted. deSEC signals a queued registration with 202 (identically for brand-new and already-registered emails, to prevent enumeration); any other code means the request was rejected, rate-limited, or errored server-side, and the raw response body is embedded in the message for diagnosis.","triggerScenarios":"POST {desecApiBase}/auth/ returns 400 (invalid email syntax or password below deSEC's strength policy), 429 (registration rate limit), 401/403, or 5xx; or a misconfigured desecApiBase whose /auth/ route answers with a different status.","commonSituations":"Typo'd or syntactically invalid email; generated password failing deSEC's policy; automated tests hammering registration and tripping 429; a desec.io outage or API change; ConfigurationManager desecApiBase pointing at the wrong base URL.","solutions":["Read the embedded response body in the exception message — deSEC states the exact rejection reason there","Verify the email is syntactically valid and reachable, and the password meets deSEC's policy","On HTTP 429, back off and retry registration later instead of retrying immediately","Confirm desecApiBase resolves to https://desec.io/api/v1","On 5xx, check desec.io status pages and retry once the service recovers"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"$email = trim($email);\nif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {\n    throw new \\InvalidArgumentException('Invalid email address.');\n}\nif (strlen($password) < 10) {\n    throw new \\InvalidArgumentException('Password too weak for deSEC (min 10 chars).');\n}","typeGuard":null,"tryCatchPattern":"try {\n    $manager->registerAccount($email, $password);\n} catch (\\Exception $e) {\n    if (str_starts_with($e->getMessage(), 'Unexpected response from deSEC during account registration')) {\n        // $e->getMessage() contains HTTP code + raw body; surface body to the user verbatim\n    }\n    throw $e;\n}","preventionTips":["Validate email syntax and password strength client-side before submitting the form","Never auto-retry registration on failure — 202 vs error is ambiguous by design and retries can trip 429","Keep desecApiBase pinned to the documented https://desec.io/api/v1 base"],"tags":["php","desec","dns","http-status","registration"],"backgroundTag":"unexpected-http-status","analyzedSha":"6b788eec5e61733cf03ed380a3572e43ae3f11ce","analyzedAt":"2026-08-21T05:47:24.382Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}