{"record":{"id":"5c54b6dd75f09159","repo":"HKUDS/DeepTutor","slug":"auth-is-disabled-user-creation-is-not-available","errorCode":null,"errorMessage":"Auth is disabled — user creation is not available.","messagePattern":"Auth is disabled — user creation is not available\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"deeptutor/api/routers/auth.py","lineNumber":770,"sourceCode":"@router.get(\"/users\", response_model=list[UserInfo])\nasync def get_users(_: TokenPayload = Depends(require_admin)) -> list[UserInfo]:\n    \"\"\"List all registered users. Requires admin role.\"\"\"\n    return [UserInfo(**u) for u in list_users()]\n\n\n@router.post(\"/users\", status_code=status.HTTP_201_CREATED)\nasync def admin_create_user(\n    body: RegisterRequest,\n    current: TokenPayload = Depends(require_admin),\n) -> dict:\n    \"\"\"Admin-only: create a new user account.\n\n    Replaces the public ``/register`` flow once the first admin exists. The\n    new account is always created with role=``user``; admins can promote\n    later via ``PUT /users/{username}/role``.\n    \"\"\"\n    if not AUTH_ENABLED:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=\"Auth is disabled — user creation is not available.\",\n        )\n\n    if POCKETBASE_ENABLED:\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=\"Failed to create user — username may already be taken.\",\n            )\n        logger.info(\n            f\"Admin '{current.username if current else 'local'}' created PocketBase user \"\n            f\"'{body.username}'\"\n        )\n        return {\n            \"ok\": True,\n            \"user_id\": result.get(\"id\", \"\"),","sourceCodeStart":752,"sourceCodeEnd":788,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/auth.py#L752-L788","documentation":"Error \"Auth is disabled — user creation is not available.\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/auth.py:770 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"}