{"record":{"id":"e8d44c41b197e65f","repo":"HKUDS/DeepTutor","slug":"self-registration-is-closed-ask-an-administrator","errorCode":null,"errorMessage":"Self-registration is closed. Ask an administrator to create your account.","messagePattern":"Self-registration is closed\\. Ask an administrator to create your account\\.","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"deeptutor/api/routers/auth.py","lineNumber":515,"sourceCode":"    Bootstrap-only registration.\n\n    Public endpoint that creates the *first* admin account when the user store\n    is empty. Once an admin exists, this endpoint is closed; further accounts\n    must be created by an admin via ``POST /api/v1/auth/users``.\n\n    Only available when AUTH_ENABLED=true.\n    \"\"\"\n    if not AUTH_ENABLED:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=\"Auth is disabled — registration is not available.\",\n        )\n\n    if POCKETBASE_ENABLED:\n        # PocketBase deployments are documented as single-user. Keep registration\n        # closed and require admins to provision users in the PocketBase admin UI.\n        if not is_first_user():\n            raise HTTPException(\n                status_code=status.HTTP_403_FORBIDDEN,\n                detail=\"Self-registration is closed. Ask an administrator to create your account.\",\n            )\n        result = register_pb(username=body.username, email=body.username, password=body.password)\n        if not result:\n            raise HTTPException(\n                status_code=status.HTTP_409_CONFLICT,\n                detail=\"Registration failed — username or email may already be taken.\",\n            )\n        logger.info(f\"First user registered via PocketBase: '{body.username}'\")\n        return {\n            \"ok\": True,\n            \"user_id\": result.get(\"id\", \"\"),\n            \"username\": body.username,\n            \"role\": \"user\",\n            \"is_first_user\": True,\n            \"is_admin\": False,\n        }","sourceCodeStart":497,"sourceCodeEnd":533,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/auth.py#L497-L533","documentation":"Error \"Self-registration is closed. Ask an administrator to create your account.\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/auth.py:515 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}