open-webui/open-webui · error · HTTPException
File upload to presigned URL timed out
Error message
File upload to presigned URL timed out
What it means
Raised as HTTP 504 when the PUT of the file body to the presigned URL exceeds self.timeout (default 300 s). Unlike the batch call, the upload throughput is bounded by your uplink and the storage backend (OSS presigned PUT), so big files on slow links are the main driver; presigned URLs also expire, and expiry can manifest as either this or an HTTP error.
Source
Thrown at backend/open_webui/retrieval/loaders/mineru.py:308
def _upload_to_presigned_url(self, upload_url: str) -> None:
"""
Upload file to presigned URL (no authentication needed).
"""
log.info(f'Uploading file to presigned URL')
try:
with open(self.file_path, 'rb') as f:
response = requests.put(
upload_url,
data=f,
timeout=self.timeout,
)
response.raise_for_status()
except FileNotFoundError:
raise HTTPException(status.HTTP_404_NOT_FOUND, detail=f'File not found: {self.file_path}')
except requests.Timeout:
raise HTTPException(
status.HTTP_504_GATEWAY_TIMEOUT,
detail='File upload to presigned URL timed out',
)
except requests.HTTPError as e:
raise HTTPException(
status.HTTP_400_BAD_REQUEST,
detail=f'Failed to upload file to presigned URL: {e}',
)
except Exception as e:
raise HTTPException(
status.HTTP_500_INTERNAL_SERVER_ERROR,
detail=f'Error uploading file: {str(e)}',
)
log.info('File uploaded successfully')
def _poll_batch_status(self, batch_id: str, filename: str) -> dict:
"""View on GitHub (pinned to 01f4282f1f)
Solutions
- Increase the timeout parameter for large files (600-1200 s)
- Compress/downsample oversized scans before parsing
- Check uplink utilization during the upload window
- If the URL expired before the transfer started, re-run to obtain a fresh presigned URL
Example fix
// before loader = MinerULoader(file_path=big_pdf, api_mode='cloud', api_key=key, timeout=300) // after loader = MinerULoader(file_path=big_pdf, api_mode='cloud', api_key=key, timeout=1200)
Defensive patterns
Strategy: retry
Validate before calling
import os
size_mb = os.path.getsize(path) / 1e6
uplink_mbps = measure_uplink() # periodic speed probe
est_s = size_mb * 8 / max(1, uplink_mbps)
assert timeout_sec > est_s * 2, f'timeout {timeout_sec}s too small for {size_mb:.0f} MB' Try / catch
for attempt in range(2):
try:
docs = loader.load()
break
except HTTPException as e:
if e.status_code == 504 and 'presigned URL timed out' in e.detail and attempt == 0:
continue # fresh URL + fresh timeout on retry
raise Prevention
- Scale timeout with file size; big scans are not 300 s uploads
- Compress oversized scanned PDFs before sending
- Monitor uplink saturation during bulk ingestion windows
When it happens
Trigger: Uploading a multi-hundred-MB scanned PDF over a slow uplink where elapsed time passes self.timeout; saturated upstream bandwidth; storage endpoint in a distant region adding latency.
Common situations: Office uplink ~10 Mbps uploading 500 MB files; timeout left at default while document sizes grew; Wi-Fi/VPN links with erratic throughput.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- MinerU Local API request timed out
- Failed to request upload URL: {e}
- Error requesting upload URL: {str(e)}
- Failed to upload file to presigned URL: {e}
- Error uploading file: {str(e)}
AI-assisted analysis of open-webui/open-webui@01f4282f1f (2026-08-14).
Data as JSON: /api/errors/e85bb363ba67479a.
Report an issue: GitHub.