{"record":{"id":"6bbe210a559a7d93","repo":"HKUDS/DeepTutor","slug":"avatar-not-found","errorCode":null,"errorMessage":"Avatar not found","messagePattern":"Avatar not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"deeptutor/api/routers/auth.py","lineNumber":729,"sourceCode":"    \"\"\"Remove the current user's uploaded avatar image and reset the marker.\"\"\"\n    current = _require_profile_identity(payload)\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    set_avatar(current.username, \"\")\n    return {\"ok\": True, \"avatar\": \"\"}\n\n\n@router.get(\"/avatar/{user_id}\")\nasync def get_avatar_image(\n    user_id: str,\n    _: TokenPayload | None = Depends(require_auth),\n) -> FileResponse:\n    \"\"\"Serve a stored avatar image. Any authenticated user may view avatars\n    (they appear in the admin table and next to the viewer's own profile).\"\"\"\n    if not _USER_ID_RE.match(user_id):\n        raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=\"Avatar not found\")\n\n    from deeptutor.multi_user.identity import get_avatar_file\n\n    target = get_avatar_file(user_id)\n    if target is None:\n        raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=\"Avatar not found\")\n\n    media_type = _AVATAR_MEDIA_TYPES.get(target.suffix.lstrip(\".\"), \"application/octet-stream\")\n    headers = {\n        # Private user content; the marker version in the URL handles busting.\n        \"Cache-Control\": \"private, max-age=86400\",\n        \"X-Content-Type-Options\": \"nosniff\",\n        \"Content-Disposition\": \"inline\",\n    }\n    return FileResponse(path=str(target), media_type=media_type, headers=headers)\n\n\n# ---------------------------------------------------------------------------","sourceCodeStart":711,"sourceCodeEnd":747,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/auth.py#L711-L747","documentation":"Error \"Avatar not found\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/auth.py:729 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"}