{"record":{"id":"fabc175b4696d23b","repo":"HKUDS/DeepTutor","slug":"avatar-upload-is-not-available-in-pocketbase-mode","errorCode":null,"errorMessage":"Avatar upload is not available in PocketBase mode.","messagePattern":"Avatar upload is not available in PocketBase mode\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"deeptutor/api/routers/auth.py","lineNumber":662,"sourceCode":"    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).\n    \"\"\"\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        )","sourceCodeStart":644,"sourceCodeEnd":680,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/auth.py#L644-L680","documentation":"Error \"Avatar upload is not available in PocketBase mode.\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/auth.py:662 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"}