Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: improve error handling for file retrieval in AwsS3Storage (#12002)

-LAN-c4091c4c6627
diff --git a/api/extensions/storage/aws_s3_storage.py b/api/extensions/storage/aws_s3_storage.py
index ab2d0fba3b1..ce36c2e7dee 100644
--- a/api/extensions/storage/aws_s3_storage.py
+++ b/api/extensions/storage/aws_s3_storage.py
@@ -67,7 +67,9 @@ class AwsS3Storage(BaseStorage):
yield from response["Body"].iter_chunks()
except ClientError as ex:
if ex.response["Error"]["Code"] == "NoSuchKey":
- raise FileNotFoundError("File not found")
+ raise FileNotFoundError("file not found")
+ elif "reached max retries" in str(ex):
+ raise ValueError("please do not request the same file too frequently")
else:
raise