tonhowtf/omniget · error · anyhow::Error

variante sumiu do catálogo

Error message

variante {auto} sumiu do catálogo

What it means

After auto_variant_id() picks an id, pick_asset re-looks it up in the static catalog; failing there means the auto-detected id is inconsistent with the table — an internal invariant violation ('the variant vanished from the catalog').

Solutions

  1. Re-sync auto_variant_id() with the asset catalog so every auto id exists in the table
  2. Reinstall/upgrade the app — the shipped catalog may be corrupted or outdated
  3. Check whether a cargo feature gate excluded the asset and enable it
  4. Report as a bug: this is an internal consistency error, not user input error

Example fix

// before: auto id "linux-arm64" missing from ASSETS table
// after: ensure catalog entry exists
const ASSETS: &[Asset] = &[ /* ... */ Asset { id: "linux-arm64", /* ... */ } ];
Defensive patterns

Strategy: try-catch

Validate before calling

// CI check: every id auto_variant_id() can emit must exist in the catalog
#[test]
fn auto_ids_exist_in_catalog() {
    if let Some(id) = onnxrt::auto_variant_id() {
        assert!(onnxrt::asset_by_id(id).is_some(), "auto id {id} missing from catalog");
    }
}

Try / catch

match onnxrt::install_runtime(None) {
    Err(e) if e.to_string().contains("sumiu do catálogo") => {
        bug_report!("catalog inconsistency: auto id not in ASSETS");
        return Err(e);
    }
    other => other,
}

Prevention

When it happens

Trigger: auto_variant_id() returns an id that asset_by_id() cannot find — e.g. the catalog Assets table was edited/filtered (feature-gated builds) and no longer contains the id auto-detection still emits.

Common situations: Version drift after editing the asset list without updating auto_variant_id(); cargo feature flags excluding an asset; typo introduced when renaming an id.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

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

fn asset_by_id(id: &str) -> Option<&'static Asset> {
    ASSETS.iter().find(|a| a.id == id)
}

fn pick_asset(variant: Option<&str>) -> anyhow::Result<&'static Asset> {
    let wanted = variant
        .map(|s| s.trim())
        .filter(|s| !s.is_empty() && *s != "auto");
    if let Some(id) = wanted {
        return asset_by_id(id)
            .ok_or_else(|| anyhow!("variante de ONNX Runtime desconhecida: {id}"));
    }
    let auto = auto_variant_id().ok_or_else(|| {
        anyhow!(
            "a Microsoft não publica ONNX Runtime pronto para este sistema; \
             instale a partir de um arquivo local (pacote `onnxruntime` do pip, por exemplo)"
        )
    })?;
    asset_by_id(auto).ok_or_else(|| anyhow!("variante {auto} sumiu do catálogo"))
}

pub fn target_dir() -> Option<PathBuf> {
    crate::core::paths::app_data_dir().map(|d| d.join("onnxruntime"))
}

pub fn target_path() -> Option<PathBuf> {
    target_dir().map(|d| d.join(lib_filename()))
}

pub fn version_marker_path() -> Option<PathBuf> {
    target_dir().map(|d| d.join("onnxruntime.version"))
}

/// A lib em uso e de onde ela veio: `"env"` quando o usuário apontou
/// `ORT_DYLIB_PATH`, `"managed"` quando é a que o OmniGet baixou.
pub fn resolve_with_source() -> Option<(PathBuf, &'static str)> {
    if let Ok(raw) = std::env::var("ORT_DYLIB_PATH") {

View on GitHub (pinned to 8600b91f42)