{"record":{"id":"dc9722851e0b8a84","repo":"HKUDS/DeepTutor","slug":"user-not-found","errorCode":null,"errorMessage":"User not found","messagePattern":"User not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"deeptutor/api/routers/auth.py","lineNumber":640,"sourceCode":"            role=current.role,\n            created_at=\"\",\n        )\n    return UserInfo(**info)\n\n\n@router.put(\"/profile\")\nasync def update_profile(\n    body: UpdateProfileRequest,\n    payload: TokenPayload | None = Depends(require_auth),\n) -> dict:\n    \"\"\"Update the current user's own avatar marker (icon choice or reset).\n\n    Only the validated ``icon:<name>:<color>`` form (or empty string) is\n    accepted here; ``img:`` markers are owned by the upload endpoint.\n    \"\"\"\n    current = _require_profile_identity(payload)\n    if not set_avatar(current.username, body.avatar):\n        raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=\"User not found\")\n    # The marker no longer references an uploaded image, so drop the file.\n    from deeptutor.multi_user.identity import delete_avatar_file\n\n    if current.user_id and _USER_ID_RE.match(current.user_id):\n        delete_avatar_file(current.user_id)\n    return {\"ok\": True, \"avatar\": body.avatar}\n\n\n@router.put(\"/profile/avatar\")\nasync def upload_avatar(\n    file: UploadFile = File(...),\n    payload: TokenPayload | None = Depends(require_auth),\n) -> dict:\n    \"\"\"Upload an avatar image for the current user.\n\n    The client is expected to crop/resize before uploading; the server only\n    enforces a size cap and validates the format by magic bytes. Not available\n    in PocketBase mode (those identities have no local user record).","sourceCodeStart":622,"sourceCodeEnd":658,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/auth.py#L622-L658","documentation":"Error \"User not found\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/auth.py:640 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"}