{"record":{"id":"8ae4beabb07821c0","repo":"HKUDS/DeepTutor","slug":"auth-is-disabled-registration-is-not-available","errorCode":null,"errorMessage":"Auth is disabled — registration is not available.","messagePattern":"Auth is disabled — registration is not available\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"deeptutor/api/routers/auth.py","lineNumber":506,"sourceCode":"    (see the rationale there and #623).\n    \"\"\"\n    response.delete_cookie(**_cookie_attrs())\n    return {\"ok\": True}\n\n\n@router.post(\"/register\", status_code=status.HTTP_201_CREATED)\nasync def register(body: RegisterRequest) -> dict:\n    \"\"\"\n    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            )","sourceCodeStart":488,"sourceCodeEnd":524,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/auth.py#L488-L524","documentation":"Error \"Auth is disabled — registration is not available.\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/auth.py:506 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"}