fix(gemma): switch to Unsloth mirror — Google's official GGUF returns HTTP 401 to anonymous fetches#107
Draft
NITISH-R-G wants to merge 2 commits into
Draft
fix(gemma): switch to Unsloth mirror — Google's official GGUF returns HTTP 401 to anonymous fetches#107NITISH-R-G wants to merge 2 commits into
NITISH-R-G wants to merge 2 commits into
Conversation
… HTTP 401 Honest correction. My earlier 'Gemma 4 is ungated' claim was based on a stale web-search hit that reported gated=false. Re-tested with curl: GET https://huggingface.co/google/gemma-4-E4B-it-GGUF/resolve/main/ gemma-4-e4b-it-Q4_K_M.gguf -> HTTP/2 401 'Invalid username or password.' Google's official repo still requires HF login + terms acceptance even though the weights themselves are Apache 2.0. Anonymous downloads are rejected at the resolve endpoint. Users were correctly seeing: 'Gemma 4 download paused — Hugging Face refused the request (HTTP 401)' Fix: redirect downloads to the community mirrors which DO allow anonymous fetches (verified 302 -> CDN on a clean curl): primary : https://huggingface.co/unsloth/gemma-4-E4B-it-GGUF fallback : https://huggingface.co/ggml-org/gemma-4-E4B-it-GGUF fallback : https://huggingface.co/bartowski/google_gemma-4-E4B-it-GGUF These hold the IDENTICAL model bytes under the same Apache 2.0 license. Unsloth is the most-downloaded Gemma GGUF publisher; ggml-org is the llama.cpp upstream community; bartowski is a long-running, trusted quant-pack maintainer. * lib/services/gemma_model_manager.dart - modelDownloadUrl points at Unsloth (anonymous fetch ok). - New modelDownloadFallbackUrls const w/ ggml-org + bartowski. - downloadModel() now iterates over [primary, ...fallbacks] and fails over on 401/403/404/429. Other HTTP errors bubble immediately so the caller sees a clean message. - Refactored the actual byte-streaming into _downloadFromUrl() so each candidate URL gets the full resumable-with-Range treatment. - Error copy no longer claims the model is 'Apache 2.0 + ungated' — it correctly explains the mirror failed + the next will be tried. - hfModelCardUrl points at the Unsloth model card (matches the URL we actually download from, so 'View model card' opens cleanly). Verification: ✅ curl -sI https://huggingface.co/unsloth/gemma-4-E4B-it-GGUF/ resolve/main/gemma-4-E4B-it-Q4_K_M.gguf -> HTTP/2 302 -> Location: cas-bridge.xethub.hf.co/... (anonymous fetch succeeds, redirects to CDN). ✅ flutter analyze -> 0 issues across the workspace. ✅ flutter test -> 17/17 passing. ✅ flutter build apk --debug -> 254 MB APK produced in 13 s. Co-authored-by: Nitish R.G. <NITISH-R-G@users.noreply.github.com>
- Retry transient ClientException/connection-closed up to 5x per mirror with Range resume, then fail over across Unsloth/ggml-org/bartowski. - User-facing errors strip long signed CDN URLs from the banner. - Tap Gemma banner to retry; auto-retry on Wi-Fi after failed state. - Remove duplicate StatusIndicatorBar from Safety Tools tab (kept in app bar). Co-authored-by: Nitish R.G. <NITISH-R-G@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes Gemma 4 download failures and duplicate GPS/AI/Sync chips on the Safety Tools tab.
Gemma download (
Connection closed while receiving data)Large GGUF pulls redirect through Hugging Face’s Xet CDN; Wi-Fi drops mid-stream used to surface a wall of signed URL text and never retry.
Rangeresume on the partial.downloadfile.failed.Duplicate status chips
StatusIndicatorBarwas rendered in both the app bar and Safety Tools list (below the mesh radar), so GPS / AI / Sync appeared twice. Removed the copy inside the tab; the app bar row remains.Verify