diff --git a/frigate/http.py b/frigate/http.py index 9b21053c5..1f4fb4e75 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -884,6 +884,10 @@ def get_recordings_storage_usage(): current_app.stats_tracking, current_app.hwaccel_errors, )["service"]["storage"][RECORD_DIR] + + if not recording_stats: + return jsonify({}) + total_mb = recording_stats["total"] camera_usages: dict[ diff --git a/frigate/stats.py b/frigate/stats.py index 97eba0bb9..86ac3780b 100644 --- a/frigate/stats.py +++ b/frigate/stats.py @@ -241,7 +241,11 @@ def stats_snapshot( } for path in [RECORD_DIR, CLIPS_DIR, CACHE_DIR, "/dev/shm"]: - storage_stats = shutil.disk_usage(path) + try: + storage_stats = shutil.disk_usage(path) + except FileNotFoundError: + stats["service"]["storage"][path] = {} + stats["service"]["storage"][path] = { "total": round(storage_stats.total / 1000000, 1), "used": round(storage_stats.used / 1000000, 1),