tonhowtf/omniget · error
startup runtime
Error message
startup runtime
What it means
In run(), a "startup-checks" thread builds a dedicated current-thread tokio runtime to run ensure_ytdlp() before the first download. Builder::build() fails (Err) when the runtime cannot be created (e.g. too many threads/resources, or a runtime feature misconfiguration), and .expect("startup runtime") panics that background thread. The app continues but startup checks silently die.
Solutions
- Replace .expect with error handling that logs and skips startup checks instead of panicking the thread.
- Verify tokio Cargo features (enable_all requires rt and the needed drivers) are correctly enabled.
- Reuse the existing tauri::async_runtime instead of constructing a second runtime for startup checks.
- Check OS resource limits (ulimit -u / -n) if failures occur on low-end machines.
Example fix
// before
let rt = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("startup runtime");
// after
let rt = match tokio::runtime::Builder::new_current_thread().enable_all().build() {
Ok(rt) => rt,
Err(e) => {
tracing::error!("failed to build startup runtime: {e}; skipping startup checks");
return;
}
}; Defensive patterns
Strategy: try-catch
Try / catch
match tokio::runtime::Builder::new_current_thread().enable_all().build() {
Ok(rt) => rt.block_on(startup_checks()),
Err(e) => tracing::error!("startup runtime unavailable: {e}"),
} Prevention
- Prefer reusing tauri::async_runtime instead of a bespoke runtime
- Verify tokio rt/time/fs features in Cargo.toml
- Never panic inside spawned startup threads; log and degrade
When it happens
Trigger: tokio::runtime::Builder::new_current_thread().enable_all().build() returns Err on the startup-checks thread — resource exhaustion (thread/io handles), invalid runtime configuration, or a broken tokio build feature set.
Common situations: App started in a heavily resource-constrained environment; conflicting tokio runtime feature flags in Cargo.toml; multiple runtimes spawned rapidly at startup hitting OS limits.
Related errors
- spawn_blocking failed: {}
- spawn_blocking failed: {}
- worker task panicked: {:?}
- spawn_blocking failed: {}
- tarefa de remoção de fundo falhou: {e}
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/c30831764899a433.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/src/lib.rs:786
.filter(|p| p.enabled && !mgr.is_loaded(&p.id))
.map(|p| p.id.clone())
.collect();
for id in &to_load {
let _ = mgr.load_one(id, std::sync::Arc::clone(&host));
}
}
let _ = app_emit.emit("plugins-changed", ());
})
.ok();
}
std::thread::Builder::new()
.name("startup-checks".into())
.spawn(|| {
let rt = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("startup runtime");
rt.block_on(async {
// Garante o yt-dlp (zipapp quando há Python, senão o
// onefile) antes do primeiro download pedir por ele.
if let Err(e) = core::ytdlp::ensure_ytdlp().await {
tracing::warn!("yt-dlp not available at startup: {}", e);
}
core::dependencies::ensure_js_runtime().await;
let _ = tokio::task::spawn_blocking(
core::ytdlp::cleanup_stale_pyinstaller_dirs,
)
.await;
// O `--update-to` é um bootstrap inteiro do yt-dlp
// mais rede, e trocar o binário com download ativo
// quebra o processo (B2). Espera o app assentar e só
// roda sem yt-dlp em andamento; se a fila está cheia,
// tenta de novo a cada 5 min por até uma hora.
tokio::time::sleep(std::time::Duration::from_secs(45)).await;
for _ in 0..12 {View on GitHub (pinned to 8600b91f42)