{"record":{"id":"f3244e840a115465","repo":"HKUDS/DeepTutor","slug":"role-must-be-admin-or-user","errorCode":null,"errorMessage":"Role must be 'admin' or 'user'","messagePattern":"Role must be 'admin' or 'user'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"deeptutor/api/routers/auth.py","lineNumber":132,"sourceCode":"\n    @field_validator(\"password\")\n    @classmethod\n    def password_valid(cls, v: str) -> str:\n        if len(v) < 8:\n            raise ValueError(\"Password must be at least 8 characters\")\n        return v\n\n\nclass SetRoleRequest(BaseModel):\n    \"\"\"Payload for the PUT /users/{username}/role endpoint.\"\"\"\n\n    role: str\n\n    @field_validator(\"role\")\n    @classmethod\n    def role_valid(cls, v: str) -> str:\n        if v not in (\"admin\", \"user\"):\n            raise ValueError(\"Role must be 'admin' or 'user'\")\n        return v\n\n\nclass AuthStatusResponse(BaseModel):\n    \"\"\"Response body for the GET /status endpoint.\"\"\"\n\n    enabled: bool\n    authenticated: bool\n    user_id: str | None = None\n    username: str | None = None\n    role: str | None = None\n    is_admin: bool = False\n    avatar: str = \"\"\n\n\nclass UserInfo(BaseModel):\n    \"\"\"Single user record returned by the GET /users and /profile endpoints.\"\"\"\n","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/auth.py#L114-L150","documentation":"Error \"Role must be 'admin' or 'user'\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/auth.py:132 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"}