{"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":"anyhow::Error","httpStatus":null,"severity":"warning","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/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-update/src/check.rs#L99-L135","documentation":"The update checker spawns a thread and builds a single-threaded tokio runtime on it (Builder::new_current_thread().enable_all().build()); the build failed. This is an environment-level failure — typically thread/resource exhaustion or an OS restriction — not a network problem.","triggerScenarios":"check_status running on a machine at the process limit for threads or file descriptors, in a sandbox that forbids thread/epoll creation, or under memory pressure where the runtime allocation fails.","commonSituations":"Long-running desktop app with a thread leak eventually cannot spawn runtimes; restricted containers/CI sandboxes; very low ulimits.","solutions":["Check thread and fd limits (ulimit -n, ulimit -u) and raise them if the process is exhausted","Look for thread leaks in the app (this runtime-per-check pattern allocates one thread each call)","Retry the update check later — transient resource pressure clears","In sandboxes, allow thread/epoll creation for the app process"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// before spawning, sanity-check resource headroom\n// (cheap heuristic; real cause shows in OS errors)\nif std::thread::available_parallelism().is_err() { /* heavily restricted env: skip update check */ }","typeGuard":null,"tryCatchPattern":"if let Err(e) = but_update::check::check_status(...) {\n    if e.to_string().contains(\"Failed to create runtime\") {\n        // environment issue, not an update problem: log once and skip\n    }\n}","preventionTips":["Treat update-check failures as non-fatal: never block app startup on them","Raise ulimits / fix thread leaks if this recurs — runtime build failure signals resource exhaustion","Use the cached CheckUpdateStatus from the DB when a fresh check fails"],"tags":["rust","tokio","runtime","resource-exhaustion","update-checker","but-update"],"backgroundTag":"runtime-initialization-failed","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}