{"record":{"id":"ec49c505cf26007b","repo":"tonhowtf/omniget","slug":"unreachable","errorCode":null,"errorMessage":"unreachable: {}","messagePattern":"unreachable: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/http_fetcher.rs","lineNumber":677,"sourceCode":"    url: &str,\n    headers: Option<&reqwest::header::HeaderMap>,\n    timeout: Duration,\n) -> anyhow::Result<RemoteProbe> {\n    let mut req = client.head(url);\n    if let Some(h) = headers {\n        req = req.headers(h.clone());\n    }\n    let head = match tokio::time::timeout(timeout, req.send()).await {\n        Ok(Ok(r)) if r.status().is_success() => Some(r),\n        Ok(Ok(r)) => {\n            tracing::debug!(\"[http_fetcher] HEAD returned HTTP {}\", r.status());\n            None\n        }\n        // Sem conexão não adianta tentar o GET de 1 byte: é o mesmo host.\n        // Falhar aqui poupa um segundo timeout inteiro por tentativa quando o\n        // servidor está fora (proof.ovh.net levou 495 s para desistir).\n        Ok(Err(e)) if e.is_connect() => {\n            return Err(anyhow!(\"unreachable: {}\", e));\n        }\n        Ok(Err(e)) => {\n            tracing::debug!(\"[http_fetcher] HEAD failed: {}\", e);\n            None\n        }\n        Err(_) => {\n            return Err(anyhow!(\n                \"unreachable: connect timed out after {:?}\",\n                timeout\n            ));\n        }\n    };\n\n    if let Some(resp) = head {\n        let h = resp.headers();\n        let content_length = header_content_length(h);\n        let accept_ranges = h\n            .get(reqwest::header::ACCEPT_RANGES)","sourceCodeStart":659,"sourceCodeEnd":695,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/http_fetcher.rs#L659-L695","documentation":"probe_remote first issues a HEAD request to decide whether a cheap 1-byte GET probe is needed. When the HEAD fails with a reqwest connect error (e.is_connect()), the host is definitively unreachable, so the function fails fast instead of paying a second full timeout on the GET probe. The underlying connect error is interpolated into the message.","triggerScenarios":"Calling probe/probe_url for a URL whose host refuses TCP connections (port closed), fails DNS, or otherwise errors at the connect layer, and the HEAD attempt returns Ok(Err(e)) with e.is_connect() true.","commonSituations":"Wrong port in the URL, server down or firewall dropping traffic, DNS name no longer resolving, or testing against localhost when the service is not running.","solutions":["Read the interpolated cause (DNS vs refused vs tls) to identify the exact connect failure.","Verify the URL's host and port are correct and the server is listening (curl -I <url>).","Check DNS resolution and firewall/proxy rules for the target host.","If behind a proxy, ensure reqwest's proxy configuration matches the environment."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// caller-side reachability pre-check\nlet host = url.host_str().ok_or(\"missing host\")?;\nlet port = url.port_or_known_default().unwrap_or(80);\nstd::net::TcpStream::connect((host, port)).is_ok()","typeGuard":null,"tryCatchPattern":"match probe(url).await {\n    Err(e) if e.to_string().starts_with(\"unreachable:\") => {\n        // host down: surface a user-facing 'server unreachable' state, schedule retry with backoff\n    }\n    other => { other?; }\n}","preventionTips":["Validate URL host/port before probing; typos in port are the top cause.","Implement exponential backoff retries for probe calls.","Check DNS and firewall rules in the deployment environment.","Configure proxy settings explicitly when running behind corporate proxies."],"tags":["network","connect","probe","head-request"],"backgroundTag":"connection-refused","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}