{"record":{"id":"079f158da9c364d0","repo":"tonhowtf/omniget","slug":"variante-de-onnx-runtime-desconhecida-id","errorCode":null,"errorMessage":"variante de ONNX Runtime desconhecida: {id}","messagePattern":"variante de ONNX Runtime desconhecida: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/onnxrt.rs","lineNumber":164,"sourceCode":"            id: a.id.to_string(),\n            label: a.label.to_string(),\n            bytes: a.bytes,\n            recommended: Some(a.id) == auto,\n        })\n        .collect()\n}\n\nfn 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","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/onnxrt.rs#L146-L182","documentation":"pick_asset resolves an explicit ONNX Runtime variant id via asset_by_id; when the caller passes a variant string that is not a known catalog id, it fails fast with 'variante de ONNX Runtime desconhecida' instead of silently falling back to auto-detection.","triggerScenarios":"install_runtime (or tests) called with variant=Some(\"...\") where the trimmed string is non-empty and not \"auto\", but asset_by_id(id) finds no matching Asset.","commonSituations":"Typo in the variant id passed from settings/config; catalog updated after an upgrade so an old id no longer exists; user copy-pasted a variant name from another platform.","solutions":["List valid variant ids from the onnxrt catalog (asset ids) and pass one exactly","Use \"auto\" (or None/empty) to let auto_variant_id() pick the platform asset","Update config/settings to remove the stale variant id after upgrading the app","Add the desired platform asset to the catalog if it is genuinely missing"],"exampleFix":"// before\ninstall_runtime(Some(\"win-x64-gpu115\"))  // unknown id\n// after\ninstall_runtime(Some(\"win-x64-cuda12\")) // id present in catalog\n// or\ninstall_runtime(None) // auto-detect","handlingStrategy":"validation","validationCode":"// validate variant id against the catalog before calling install_runtime\nfn is_known_variant(id: &str) -> bool {\n    let id = id.trim();\n    id.is_empty() || id == \"auto\" || onnxrt::asset_ids().contains(&id)\n}\nif !is_known_variant(user_variant) { eprintln!(\"unknown variant {user_variant}\"); }","typeGuard":"fn valid_variant(v: &Option<String>) -> bool {\n    v.as_deref().map(|s| {\n        let s = s.trim();\n        s.is_empty() || s == \"auto\" || onnxrt::asset_ids().contains(&s.to_string())\n    }).unwrap_or(true)\n}","tryCatchPattern":"match onnxrt::install_runtime(variant.as_deref()) {\n    Err(e) if e.to_string().starts_with(\"variante de ONNX Runtime desconhecida\") => {\n        eprintln!(\"{} — valid: {}\", e, onnxrt::asset_ids().join(\", \"));\n        onnxrt::install_runtime(None)?; // fall back to auto\n    }\n    other => other?,\n}","preventionTips":["Expose the list of valid variant ids in the UI/CLI instead of free-text input","Never persist raw variant strings from old app versions; migrate them on upgrade","Default to \"auto\" unless the user explicitly chooses","Add a test enumerating catalog ids vs accepted config values"],"tags":["config","onnx","invalid-argument"],"backgroundTag":"invalid-enum-value","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"}