{"record":{"id":"57b57154549f3ce1","repo":"HKUDS/DeepTutor","slug":"avatar-image-is-too-large-max-1-mb","errorCode":null,"errorMessage":"Avatar image is too large (max 1 MB).","messagePattern":"Avatar image is too large \\(max 1 MB\\)\\.","errorType":"http","errorClass":"HTTPException","httpStatus":413,"severity":"error","filePath":"deeptutor/api/routers/auth.py","lineNumber":677,"sourceCode":"    \"\"\"\n    current = _require_profile_identity(payload)\n    if POCKETBASE_ENABLED:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=\"Avatar upload is not available in PocketBase mode.\",\n        )\n    if not current.user_id or not _USER_ID_RE.match(current.user_id):\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=\"Cannot store an avatar for this account.\",\n        )\n    info = get_user_info(current.username)\n    if info is None:\n        raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=\"User not found\")\n\n    data = await file.read(_AVATAR_MAX_BYTES + 1)\n    if len(data) > _AVATAR_MAX_BYTES:\n        raise HTTPException(\n            status_code=status.HTTP_413_REQUEST_ENTITY_TOO_LARGE,\n            detail=\"Avatar image is too large (max 1 MB).\",\n        )\n    ext = _sniff_image(data)\n    if ext is None:\n        raise HTTPException(\n            status_code=status.HTTP_415_UNSUPPORTED_MEDIA_TYPE,\n            detail=\"Avatar must be a PNG, JPEG or WebP image.\",\n        )\n\n    from deeptutor.multi_user.identity import save_avatar_file\n\n    # Bump the version embedded in the marker so clients cache-bust the URL.\n    previous = str(info.get(\"avatar\") or \"\")\n    version = 1\n    if previous.startswith(\"img:\"):\n        try:\n            version = int(previous.split(\":\", 1)[1]) + 1","sourceCodeStart":659,"sourceCodeEnd":695,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/auth.py#L659-L695","documentation":"Error \"Avatar image is too large (max 1 MB).\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/auth.py:677 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"}