mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-11 10:34:13 -05:00
[GH-ISSUE #20263] issue: GGUF Model Upload via URL fails with TypeError in calculate_sha256 (expected str, not BufferedReader) #34668
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @a328929 on GitHub (Dec 30, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/20263
Check Existing Issues
Installation Method
Docker
Open WebUI Version
0.6.43
Ollama Version (if applicable)
No response
Operating System
Ubuntu 24.04
Browser (if applicable)
Chrome 100.0
Confirmation
README.md.Expected Behavior
When entering a valid direct download URL (e.g., a Hugging Face 'resolve' link) in the 'Upload GGUF Model' URL field, the system should successfully download and verify the model file. The backend should correctly handle the file stream during the SHA256 calculation instead of crashing with a 500 Internal Server Error (specifically a TypeError where calculate_sha256 receives a BufferedReader object instead of a file path).
Actual Behavior
When attempting to download a GGUF model using a valid direct URL (including Hugging Face 'resolve' links), the operation fails and results in a 500 Internal Server Error.
The backend logs indicate a TypeError occurs during the download process. Specifically, in open_webui/routers/ollama.py, the download_file_stream function incorrectly passes a BufferedReader object to the calculate_sha256 function in open_webui/utils/misc.py. The calculate_sha256 function expects a file path (str, bytes, or os.PathLike), causing the application to crash.
Steps to Reproduce
Navigate to Admin Settings:
Click on the User Profile icon and select Admin Settings.
Open Connections:
Click on the Connections tab in the sidebar.
Access Ollama Settings:
Find the Ollama connection entry and click the Manage/Configure icon (usually a gear or edit icon) next to it.
Enable Experimental Features:
Look for and click on "Show Experimental Functions" (or "Experimental") to reveal hidden options.
Once enabled, two upload methods will appear: "Upload File" and "Enter URL".
Select URL Upload:
Choose the "Enter URL" (Upload via URL) option.
(Note: The "Upload File" method works correctly; the issue is specific to URL uploads.)
Enter URL & Download:
Paste a valid direct download link for a GGUF model (e.g., a Hugging Face resolve link).
Click the download button.
Observe the Failure:
Wait for the download progress bar to reach 100%.
Immediately after reaching 100%, the process fails with a 500 Internal Server Error.
The backend logs show a TypeError in calculate_sha256 at this point.
Logs & Screenshots
Logs & Screenshots
Include relevant logs, errors, or screenshots to help diagnose the issue.
Note: The log indicates that download_file_stream in ollama.py passes a file object (BufferedReader) to calculate_sha256, but calculate_sha256 in misc.py attempts to use open() on it, expecting a file path string.
Additional Information
Based on the server logs, the root cause is a type mismatch in the file verification logic during the URL download process.
The Error Location:
The crash happens in open_webui/routers/ollama.py at line 1658, inside the download_file_stream function.
The Code Defect:
The code calls hashed = calculate_sha256(file, chunk_size).
It passes the file variable, which appears to be a BufferedReader object (the active download stream).
The Conflict:
The target function calculate_sha256 (in open_webui/utils/misc.py at line 340) expects a file path string, not a file object. It immediately tries to execute with open(file_path, "rb") as f:, which fails because it cannot "open" an already open BufferedReader object.
Contrast with Working Method:
The "Upload File" (local upload) feature works correctly, likely because it saves the file to a temporary path first or handles the verification differently. The "Enter URL" method seems to lack this intermediate step or incorrectly reuses the SHA256 function without adapting for stream objects.
Suggested Fix:
The download_file_stream function should either:
Save the downloaded stream to a temporary file path first, and then pass that path string to calculate_sha256.
Or, calculate_sha256 should be updated to check if the input is already a file-like object and read it directly without trying to open() it again.
@owui-terminator[bot] commented on GitHub (Dec 30, 2025):
🔍 Similar Issues Found
I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:
#16153 issue: GGUF model import fails
by thanos-k • Jul 30, 2025 •
bug#19519 issue: Base64 encoded images included in API responses
by luke-wren • Nov 26, 2025 •
bug#19264 issue: Uploaded file hash remains in database even when OCR fails, causing false duplicate detection
by flefevre • Nov 18, 2025 •
bug#19701 issue: knowledge can not multiple upload file
by willy808 • Dec 03, 2025 •
bug#11602 issue: GGUF load by url is broken
by morgan55555 • Mar 12, 2025 •
bugShow 5 more related issues
#13173 issue: Unable to create GGUF based model via interface
by ErroneousBosch • Apr 23, 2025 •
bug#17446 issue: file upload bug from 0.6.23
by K7cl • Sep 14, 2025 •
bug#1124 Impossible to upload your GGUF model
by zaperda • Mar 10, 2024
#16758 issue: Upload to S3-compatible Storage fails with XAmzContentSHA256Mismatch
by KIT-philip-hoyer • Aug 20, 2025 •
bug#12272 issue:
by Mozartuss • Apr 01, 2025 •
bug💡 Tips:
This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.
@Classic298 commented on GitHub (Dec 30, 2025):
https://github.com/open-webui/open-webui/pull/20281
@tjbck commented on GitHub (Dec 31, 2025):
6351077958@de1eted-user commented on GitHub (Apr 8, 2026):
For anyone else seeing GGUF URL downloads stuck at 100%, you can work around it by putting
ollama run hf.co/{username}/{repository}:{quantization}in the "Pull a model from Ollama.com" field under Settings -> Admin -> Models -> Manage. See https://docs.openwebui.com/features/workspace/models/#model-management