{"record":{"id":"d2594cb133c3e7ce","repo":"gitbutlerapp/gitbutler","slug":"request-failed-e","errorCode":null,"errorMessage":"Request failed: {e}","messagePattern":"Request failed: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-update/src/check.rs","lineNumber":125,"sourceCode":"        .default_headers(headers)\n        .timeout(REQUEST_TIMEOUT)\n        .build()?;\n\n    let url = url_override.unwrap_or(UPDATES_CHECK_URL).to_string();\n\n    let result = std::thread::spawn(move || -> anyhow::Result<CheckUpdateStatus> {\n        let runtime = tokio::runtime::Builder::new_current_thread()\n            .enable_all()\n            .build()\n            .map_err(|e| anyhow::anyhow!(\"Failed to create runtime: {e}\"))?;\n\n        runtime.block_on(async {\n            let response = client\n                .post(url)\n                .json(&request_body)\n                .send()\n                .await\n                .map_err(|e| anyhow::anyhow!(\"Request failed: {e}\"))?\n                .error_for_status()\n                .map_err(|e| anyhow::anyhow!(\"Server returned error: {e}\"))?;\n\n            let update_info = response\n                .json::<CheckUpdateStatus>()\n                .await\n                .map_err(|e| anyhow::anyhow!(\"Failed to parse response: {e}\"))?;\n\n            Ok(update_info)\n        })\n    })\n    .join()\n    .map_err(|_| anyhow::anyhow!(\"Update check thread panicked\"))?;\n\n    // Save to cache (convert to but_db types)\n    if let Ok(status) = &result {\n        let now = chrono::Utc::now();\n","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-update/src/check.rs#L107-L143","documentation":"Thrown when the HTTP POST to the update server (default https://app.gitbutler.com/updates) fails at the transport level — the request could not be sent or completed. This covers DNS resolution failure, connection refusal/reset, TLS errors, and the client's 30-second timeout. The error wraps the underlying reqwest error including its cause.","triggerScenarios":"check_status/check_status_with_url issuing client.post(url).json(&request_body).send() when the network is unreachable, the update host is down, DNS fails, a proxy blocks the connection, TLS fails, or the 30s REQUEST_TIMEOUT elapses.","commonSituations":"Developer machine offline or on a captive portal; corporate firewall/proxy blocking app.gitbutler.com; DNS misconfiguration; slow networks triggering the 30s timeout; update server outage.","solutions":["Verify network connectivity (curl https://app.gitbutler.com/updates) and retry.","Check proxy/VPN/firewall settings and set HTTPS_PROXY if a proxy is required.","Check DNS resolution of app.gitbutler.com.","If timeouts recur on slow links, retry later; the timeout is fixed at 30 seconds in the client builder.","Check GitButler service status for an update-server outage."],"exampleFix":"// before: one-shot request\nlet response = client.post(url).json(&request_body).send().await\n    .map_err(|e| anyhow::anyhow!(\"Request failed: {e}\"))?;\n// after: simple bounded retry for transient failures\nlet response = loop {\n    match client.post(&url).json(&request_body).send().await {\n        Ok(r) => break r.map_err(|e| anyhow::anyhow!(\"Request failed: {e}\")),\n        Err(e) if attempts < 2 => { attempts += 1; tokio::time::sleep(Duration::from_secs(2)).await; }\n        Err(e) => return Err(anyhow::anyhow!(\"Request failed: {e}\")),\n    }\n};","handlingStrategy":"retry","validationCode":"// quick reachability probe before calling the API\nlet reachable = std::net::TcpStream::connect(\"app.gitbutler.com:443\").is_ok();\nif !reachable { eprintln!(\"offline; skip update check\"); }","typeGuard":null,"tryCatchPattern":"match but_update::check_status(app, &settings, &mut cache) {\n    Err(e) if e.to_string().contains(\"Request failed\") => {\n        // network-level failure: retry with backoff or fall back to cache\n        log::warn!(\"update check network failure: {e:#}\");\n    }\n    other => other?,\n}","preventionTips":["Configure HTTPS_PROXY correctly in corporate environments.","Handle captive portals: authenticate to the network before the first update check.","Implement bounded retry with backoff around update checks.","Cache the last successful check result and show it when the network fails."],"tags":["network","http","reqwest","updater"],"backgroundTag":"http-request-failed","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}