{"record":{"id":"6e9272f33441ee89","repo":"gitbutlerapp/gitbutler","slug":"failed-to-create-runtime-e","errorCode":null,"errorMessage":"Failed to create runtime: {e}","messagePattern":"Failed to create runtime: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-update/src/check.rs","lineNumber":117,"sourceCode":"        arch: arch.to_string(),\n        version: version.to_string(),\n        app_name: app_name.to_string(),\n        posthog_id: app_settings.telemetry.distinct_id_if_enabled(),\n        install: install(),\n    };\n\n    let client = reqwest::Client::builder()\n        .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        })","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-update/src/check.rs#L99-L135","documentation":"This error is thrown when the Tokio async runtime cannot be constructed inside the dedicated update-check thread spawned by check_status_with_url. The function runs a current-thread Tokio runtime to perform its async HTTP update check from synchronous code; if tokio's runtime builder fails (e.g. due to resource exhaustion or a broken Tokio installation/feature set), the failure is wrapped with this message. It indicates an internal environment problem, not a network or server issue.","triggerScenarios":"Calling check_status or check_status_with_url when tokio::runtime::Builder::new_current_thread().enable_all().build() fails inside the spawned thread — typically from thread-local resource exhaustion, too many live runtimes, or a Tokio feature/build misconfiguration.","commonSituations":"System under severe thread/memory pressure when the update check runs; embedding in a process that restricts thread creation (rlimits, sandboxes, some CI containers); a Tokio dependency misconfiguration (io/timer drivers not enabled — though enable_all covers feature-gating, conflicting tokio versions can still break driver setup).","solutions":["Check system resources (thread limits, ulimit -u, memory) and retry the update check after pressure subsides.","Verify only one compatible tokio version is in the dependency graph (cargo tree -p tokio) and that features 'rt' and 'io' are enabled.","Retry check_status; runtime creation failures are usually transient environment issues.","If embedding this crate, consider running the update check on an already-existing async runtime instead of a fresh per-call runtime."],"exampleFix":"// before\nlet runtime = tokio::runtime::Builder::new_current_thread()\n    .enable_all()\n    .build()\n    .map_err(|e| anyhow::anyhow!(\"Failed to create runtime: {e}\"))?;\n// after (call from an async context instead of building a runtime per check)\nlet status = tokio::task::spawn_blocking(move || perform_update_check(...)).await??;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match but_update::check_status(app, &settings, &mut cache) {\n    Err(e) if e.to_string().contains(\"Failed to create runtime\") => {\n        // environment/resource problem: log and degrade gracefully\n        log::warn!(\"update check unavailable: {e:#}\");\n    }\n    result => result?,\n}","preventionTips":["Avoid nesting this call inside heavily thread-constrained contexts; check ulimit/thread budgets.","Keep the tokio dependency graph free of duplicate conflicting versions.","Treat update checks as best-effort: always fall back to cached results."],"tags":["tokio","runtime","async","updater"],"backgroundTag":"module-init-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"}