{"record":{"id":"7c9e9ec4e086a86e","repo":"tonhowtf/omniget","slug":"variante-auto-sumiu-do-cat-logo","errorCode":null,"errorMessage":"variante {auto} sumiu do catálogo","messagePattern":"variante (.+?) sumiu do catálogo","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/onnxrt.rs","lineNumber":172,"sourceCode":"fn asset_by_id(id: &str) -> Option<&'static Asset> {\n    ASSETS.iter().find(|a| a.id == id)\n}\n\nfn pick_asset(variant: Option<&str>) -> anyhow::Result<&'static Asset> {\n    let wanted = variant\n        .map(|s| s.trim())\n        .filter(|s| !s.is_empty() && *s != \"auto\");\n    if let Some(id) = wanted {\n        return asset_by_id(id)\n            .ok_or_else(|| anyhow!(\"variante de ONNX Runtime desconhecida: {id}\"));\n    }\n    let auto = auto_variant_id().ok_or_else(|| {\n        anyhow!(\n            \"a Microsoft não publica ONNX Runtime pronto para este sistema; \\\n             instale a partir de um arquivo local (pacote `onnxruntime` do pip, por exemplo)\"\n        )\n    })?;\n    asset_by_id(auto).ok_or_else(|| anyhow!(\"variante {auto} sumiu do catálogo\"))\n}\n\npub fn target_dir() -> Option<PathBuf> {\n    crate::core::paths::app_data_dir().map(|d| d.join(\"onnxruntime\"))\n}\n\npub fn target_path() -> Option<PathBuf> {\n    target_dir().map(|d| d.join(lib_filename()))\n}\n\npub fn version_marker_path() -> Option<PathBuf> {\n    target_dir().map(|d| d.join(\"onnxruntime.version\"))\n}\n\n/// A lib em uso e de onde ela veio: `\"env\"` quando o usuário apontou\n/// `ORT_DYLIB_PATH`, `\"managed\"` quando é a que o OmniGet baixou.\npub fn resolve_with_source() -> Option<(PathBuf, &'static str)> {\n    if let Ok(raw) = std::env::var(\"ORT_DYLIB_PATH\") {","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/onnxrt.rs#L154-L190","documentation":"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').","triggerScenarios":"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.","commonSituations":"Version drift after editing the asset list without updating auto_variant_id(); cargo feature flags excluding an asset; typo introduced when renaming an id.","solutions":["Re-sync auto_variant_id() with the asset catalog so every auto id exists in the table","Reinstall/upgrade the app — the shipped catalog may be corrupted or outdated","Check whether a cargo feature gate excluded the asset and enable it","Report as a bug: this is an internal consistency error, not user input error"],"exampleFix":"// before: auto id \"linux-arm64\" missing from ASSETS table\n// after: ensure catalog entry exists\nconst ASSETS: &[Asset] = &[ /* ... */ Asset { id: \"linux-arm64\", /* ... */ } ];","handlingStrategy":"try-catch","validationCode":"// CI check: every id auto_variant_id() can emit must exist in the catalog\n#[test]\nfn auto_ids_exist_in_catalog() {\n    if let Some(id) = onnxrt::auto_variant_id() {\n        assert!(onnxrt::asset_by_id(id).is_some(), \"auto id {id} missing from catalog\");\n    }\n}","typeGuard":null,"tryCatchPattern":"match onnxrt::install_runtime(None) {\n    Err(e) if e.to_string().contains(\"sumiu do catálogo\") => {\n        bug_report!(\"catalog inconsistency: auto id not in ASSETS\");\n        return Err(e);\n    }\n    other => other,\n}","preventionTips":["Keep auto_variant_id() and the ASSETS table in one module so edits stay in sync","Add a unit test asserting every auto id resolves via asset_by_id","Watch for cargo feature gates that conditionally compile out assets","Rename ids atomically (single commit touching both catalog and auto logic)"],"tags":["onnx","invariant","catalog"],"backgroundTag":"internal-invariant-violation","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}