{"record":{"id":"eabe4c73c65fb7f6","repo":"fastapi/full-stack-fastapi-template","slug":"super-users-are-not-allowed-to-delete-themselves","errorCode":null,"errorMessage":"Super users are not allowed to delete themselves","messagePattern":"Super users are not allowed to delete themselves","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"backend/app/api/routes/users.py","lineNumber":138,"sourceCode":"    session.commit()\n    return Message(message=\"Password updated successfully\")\n\n\n@router.get(\"/me\", response_model=UserPublic)\ndef read_user_me(current_user: CurrentUser) -> Any:\n    \"\"\"\n    Get current user.\n    \"\"\"\n    return current_user\n\n\n@router.delete(\"/me\", response_model=Message)\ndef delete_user_me(session: SessionDep, current_user: CurrentUser) -> Any:\n    \"\"\"\n    Delete own user.\n    \"\"\"\n    if current_user.is_superuser:\n        raise HTTPException(\n            status_code=403, detail=\"Super users are not allowed to delete themselves\"\n        )\n    session.delete(current_user)\n    session.commit()\n    return Message(message=\"User deleted successfully\")\n\n\n@router.post(\"/signup\", response_model=UserPublic)\ndef register_user(session: SessionDep, user_in: UserRegister) -> Any:\n    \"\"\"\n    Create new user without the need to be logged in.\n    \"\"\"\n    user = crud.get_user_by_email(session=session, email=user_in.email)\n    if user:\n        raise HTTPException(\n            status_code=400,\n            detail=\"The user with this email already exists in the system\",\n        )","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/fastapi/full-stack-fastapi-template/blob/8063fe54f17d19f01720e055103af9cad3d8f55d/backend/app/api/routes/users.py#L120-L156","documentation":"Error \"Super users are not allowed to delete themselves\" thrown in fastapi/full-stack-fastapi-template.","triggerScenarios":"Thrown at backend/app/api/routes/users.py:138 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":"8063fe54f17d19f01720e055103af9cad3d8f55d","analyzedAt":"2026-08-26T06:49:32.317Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}