tonhowtf/omniget · error · anyhow::Error

o ONNX Runtime ainda não está instalado. Instale pela tela…

Error message

o ONNX Runtime {} ainda não está instalado. Instale pela tela de Modelos (o download vai para {}) ou aponte um {} que você já tenha.

What it means

Raised by missing_runtime_error() when the ONNX Runtime shared library cannot be resolved but an official prebuilt build exists for this platform (auto_variant_id() is Some). The library throws it because ort::init needs a native runtime that is not yet installed; the message tells the user to install via the Models screen or point to an existing library.

Solutions

  1. Open the Models screen and install the ONNX Runtime for the current RUNTIME_VERSION
  2. Point the app to an existing onnxruntime shared library you already have (e.g. from the pip package)
  3. Re-run ensure_runtime() to trigger the download flow
  4. Verify the data directory exists and is writable so the install can land there

Example fix

// before
let path = onnxrt::init()?; // panics with missing runtime message on fresh install
// after
match onnxrt::ensure_runtime(&progress).await {
    Ok(_) => { let path = onnxrt::init()?; }
    Err(e) => eprintln!("install the runtime from the Models screen: {e}"),
}
Defensive patterns

Strategy: try-catch

Validate before calling

if onnxrt::resolve_path_hint().is_none() { prompt_runtime_install(); }

Type guard

fn runtime_available() -> bool { std::fs::metadata(configured_runtime_path()).map(|m| m.is_file()).unwrap_or(false) }

Try / catch

match onnxrt::init() { Ok(p) => p, Err(e) => { open_models_screen_with_error(e); return; } }

Prevention

When it happens

Trigger: Calling init() (directly or via ensure_runtime/api) when resolve_path() returns None: READY is unset, no runtime was downloaded, no configured path points to a valid libonnxruntime, and no system runtime was found.

Common situations: Fresh install before downloading the runtime from the Models screen; runtime dir wiped or data dir moved; ONNX_RUNTIME lib path env/config pointing nowhere; upgrading the app which bumps RUNTIME_VERSION.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/3b57120d58519f7f. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/onnxrt.rs:256

    RuntimeStatus {
        installed: found.is_some(),
        path: found.as_ref().map(|(p, _)| p.to_string_lossy().to_string()),
        source: found.as_ref().map(|(_, s)| (*s).to_string()),
        version: read_version_marker(),
        target_version: RUNTIME_VERSION.to_string(),
        lib_filename: lib_filename().to_string(),
        can_download: auto_variant_id().is_some(),
        variants: list_variants(),
    }
}

/// Mensagem de erro que diz o que fazer, em vez de só reclamar.
fn missing_runtime_error() -> anyhow::Error {
    let where_to = target_dir()
        .map(|d| d.display().to_string())
        .unwrap_or_else(|| "<pasta de dados do app>".into());
    if auto_variant_id().is_some() {
        anyhow!(
            "o ONNX Runtime {} ainda não está instalado. Instale pela tela de Modelos \
             (o download vai para {}) ou aponte um {} que você já tenha.",
            RUNTIME_VERSION,
            where_to,
            lib_filename()
        )
    } else {
        anyhow!(
            "não existe build oficial do ONNX Runtime para este sistema. \
             Aponte um {} que você já tenha (o pacote `onnxruntime` do pip traz um) — \
             ele é copiado para {}.",
            lib_filename(),
            where_to
        )
    }
}

/// Caminho que o `ort` já está usando, quando o carregamento deu certo uma vez.

View on GitHub (pinned to 8600b91f42)