diff --git a/rag/utils/minio_conn.py b/rag/utils/minio_conn.py index 11682988e3..4662c7c834 100644 --- a/rag/utils/minio_conn.py +++ b/rag/utils/minio_conn.py @@ -1,6 +1,7 @@ import logging import time from minio import Minio +from minio.error import S3Error from io import BytesIO from rag import settings from rag.utils import singleton @@ -84,8 +85,11 @@ def obj_exist(self, bucket, filename): return True else: return False + except S3Error as e: + if e.code in ["NoSuchKey", "NoSuchBucket", "ResourceNotFound"]: + return False except Exception: - logging.exception(f"Not found: {bucket}/{filename}") + logging.exception(f"obj_exist {bucket}/{filename} got exception") return False def get_presigned_url(self, bucket, fnm, expires):