{"record":{"id":"e2c01fd0539b5612","repo":"janhq/jan","slug":"http-request-failed-0","errorCode":null,"errorMessage":"HTTP request failed: {0}","messagePattern":"HTTP request failed: (.+?)","errorType":"exception","errorClass":"UpdateError","httpStatus":null,"severity":"error","filePath":"src-tauri/src/core/updater/custom_updater.rs","lineNumber":31,"sourceCode":"use reqwest::Client;\nuse serde::{Deserialize, Serialize};\nuse std::time::Duration;\nuse thiserror::Error;\n\n/// Secret key for HMAC signature\n/// - In CI: Set JAN_SIGNING_KEY environment variable at build time\n/// - In local dev: Falls back to a test key\nconst SECRET_KEY: &str = match option_env!(\"JAN_SIGNING_KEY\") {\n    Some(key) => key,\n    None => \"local-dev-test-key-not-for-production\",\n};\n\n/// Timeout for HTTP requests\nconst REQUEST_TIMEOUT_SECS: u64 = 30;\n\n#[derive(Debug, Error)]\npub enum UpdateError {\n    #[error(\"HTTP request failed: {0}\")]\n    RequestFailed(#[from] reqwest::Error),\n\n    #[error(\"Failed to parse update response: {0}\")]\n    ParseError(String),\n\n    #[error(\"All endpoints failed\")]\n    AllEndpointsFailed,\n\n    #[error(\"Invalid response from server: {0}\")]\n    InvalidResponse(String),\n\n    #[error(\"No endpoints configured\")]\n    NoEndpointsConfigured,\n}\n\n/// Update information returned by the update check endpoint\n/// Compatible with Tauri's updater format\n#[derive(Debug, Clone, Serialize, Deserialize)]","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/janhq/jan/blob/fad3f12a147d138388a66f0d92a02b2675f65294/src-tauri/src/core/updater/custom_updater.rs#L13-L49","documentation":"The RequestFailed variant of UpdateError is produced via #[from] reqwest::Error whenever an HTTP request to an update-check endpoint fails at the transport level. This covers connection refused, DNS resolution failure, TLS handshake error, connection timeout (30s), and read timeout. The {0} interpolates the reqwest error's Display output.","triggerScenarios":"The update endpoint URL is unreachable (server down, DNS failure, firewall block). Network is offline. TLS certificate expired or untrusted. Connection timed out after REQUEST_TIMEOUT_SECS (30s). Proxy misconfiguration intercepting the request.","commonSituations":"Corporate proxy blocking apps.jan.ai. DNS resolution failing on a misconfigured network. Endpoint moved or decommissioned without redirect. Captive portal intercepting HTTPS. Clock skew causing TLS certificate validity check failure.","solutions":["Verify network connectivity and that the endpoint URL is reachable via curl.","Check DNS resolution: `nslookup apps.jan.ai`.","Ensure system CA certificates are current for TLS validation.","If behind a proxy, configure HTTPS_PROXY env var or system proxy settings."],"exampleFix":"# diagnostic\ncurl -v -H 'Accept: application/json' https://apps.jan.ai/update-check\n\n# if TLS fails, check certs\nopenssl s_client -connect apps.jan.ai:443","handlingStrategy":"retry","validationCode":"// Before checking for updates, verify network connectivity\nasync fn check_network(endpoint: &str) -> bool {\n    reqwest::Client::builder()\n        .timeout(std::time::Duration::from_secs(5))\n        .build()\n        .and_then(|c| c.head(endpoint).send()) // simplified\n        .is_ok()\n}","typeGuard":null,"tryCatchPattern":"match updater.check_for_updates(endpoints, nonce, version).await {\n    Ok(Some(info)) => { /* offer update */ }\n    Ok(None) => { /* up to date */ }\n    Err(UpdateError::RequestFailed(e)) => {\n        log::warn!(\"Update check network error: {e}\");\n        // Schedule a retry with backoff\n    }\n    Err(other) => { log::warn!(\"Update check error: {other}\"); }\n}","preventionTips":["Treat update checks as best-effort: catch errors and retry with exponential backoff.","Verify system CA certificates are current for TLS validation.","Configure HTTPS_PROXY if behind a corporate proxy.","Log the endpoint URL and error detail so users can diagnose connectivity."],"tags":["network","http","reqwest","updater","timeout","tls"],"backgroundTag":null,"analyzedSha":"fad3f12a147d138388a66f0d92a02b2675f65294","analyzedAt":"2026-08-12T20:33:47.516Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}