{"record":{"id":"35c11d270b4e4382","repo":"Zackriya-Solutions/meetily","slug":"download-failed-with-status","errorCode":null,"errorMessage":"Download failed with status: {}","messagePattern":"Download failed with status: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/summary/summary_engine/model_manager.rs","lineNumber":512,"sourceCode":"            .await\n            .map_err(|e| anyhow!(\"Failed to start download: {}\", e))?;\n\n        // Check response status - 200 OK (full download) or 206 Partial Content (resume)\n        let (total_size, resuming) = if response.status() == reqwest::StatusCode::PARTIAL_CONTENT {\n            // Server supports resume - total size = existing + remaining\n            let remaining = response.content_length().unwrap_or(0);\n            log::info!(\"Server supports resume, {} MB remaining\", remaining / (1024 * 1024));\n            (existing_size + remaining, true)\n        } else if response.status().is_success() {\n            // Server doesn't support resume or fresh download\n            if existing_size > 0 {\n                log::warn!(\"Server doesn't support resume, starting fresh download\");\n            }\n            (response.content_length().unwrap_or(0), false)\n        } else {\n            let mut active = self.active_downloads.write().await;\n            active.remove(model_name);\n            return Err(anyhow!(\"Download failed with status: {}\", response.status()));\n        };\n\n        log::info!(\"Total size: {} MB\", total_size / (1024 * 1024));\n\n        // Open file for append if resuming, or create new\n        let file = if resuming {\n            OpenOptions::new()\n                .write(true)\n                .append(true)\n                .open(&file_path)\n                .await\n                .map_err(|e| anyhow!(\"Failed to open file for append: {}\", e))?\n        } else {\n            fs::File::create(&file_path)\n                .await\n                .map_err(|e| anyhow!(\"Failed to create file: {}\", e))?\n        };\n","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/summary/summary_engine/model_manager.rs#L494-L530","documentation":"The download host answered with a non-success, non-206 status; the status code is embedded verbatim. Because only 206 counts as resume, a 416 Range Not Satisfiable from a stale or already-complete partial file also lands here. 404 means the file is gone, 403/429 mean access/rate limiting, 5xx are transient.","triggerScenarios":"Model file removed or relocated at the CDN (404); auth token/hotlink expired (403); rate-limited after repeated downloads (429); resuming when the partial file already equals or exceeds the remote size (416); transient 502/503 from the origin.","commonSituations":"HuggingFace repo restructure removing a GGUF; too many downloads from one IP; leftover complete partial file after a crashed session making the Range header invalid.","solutions":["On 416: delete the partial file and retry fresh — the existing file already satisfies or exceeds the range","On 429/5xx: wait and retry; resume keeps the downloaded progress","On 404/403: the model definition's download_url (or token) must be updated; the file moved at the host","Surface the status code in the UI so users can distinguish 'try later' from 'broken link'"],"exampleFix":"// before: resuming blindly can trigger 416\nrequest = request.header(\"Range\", format!(\"bytes={}-\", existing_size));\n\n// after: validate the partial file against the remote size first\nlet head = client.head(&model_def.download_url).send().await?;\nlet remote_len = head.content_length().unwrap_or(0);\nif existing_size >= remote_len && remote_len > 0 {\n    tokio::fs::remove_file(&file_path).await?; // stale/complete partial: start fresh\n    existing_size = 0;\n}","handlingStrategy":"retry","validationCode":"// Avoid 416: validate the partial file against the remote size before resuming\nlet head = client.head(&model_def.download_url).send().await?;\nif let Some(remote) = head.content_length() {\n    if existing_size >= remote {\n        tokio::fs::remove_file(&file_path).await.ok(); // stale/complete partial\n    }\n}","typeGuard":null,"tryCatchPattern":"match manager.download_model_detailed(name, cb).await {\n    Err(e) if e.to_string().starts_with(\"Download failed with status: 416\") => {\n        delete_partial_file(name); manager.download_model_detailed(name, cb).await // fresh\n    }\n    Err(e) if e.to_string().starts_with(\"Download failed with status: 429\") => {\n        tokio::time::sleep(Duration::from_secs(60)).await; retry()\n    }\n    other => other,\n}","preventionTips":["Compare partial-file size with Content-Length before sending a Range header","Back off on 429 instead of hammering the host","Keep model download_urls in one registry file so CDN moves are a one-line fix"],"tags":["http","status-code","download","rust"],"backgroundTag":"http-error-status","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}