{"record":{"id":"9a4f520a6acb3c7b","repo":"tonhowtf/omniget","slug":"n-o-parece-a-biblioteca-do-onnx-runtime-deste-sistema","errorCode":null,"errorMessage":"{} não parece a biblioteca do ONNX Runtime deste sistema (esperava algo como {})","messagePattern":"(.+?) não parece a biblioteca do ONNX Runtime deste sistema \\(esperava algo como (.+?)\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/onnxrt.rs","lineNumber":523,"sourceCode":"    if let Some(marker) = version_marker_path() {\n        let _ = std::fs::write(&marker, format!(\"{} ({})\", RUNTIME_VERSION, asset.file));\n    }\n    strip_quarantine(&out).await;\n    crate::core::tools::report(progress, \"onnxruntime\", \"done\", 1, Some(1), None);\n    Ok(out)\n}\n\n/// Instala a partir de um arquivo que o usuário já tem no disco.\npub fn install_from_path(source: &Path) -> anyhow::Result<PathBuf> {\n    if !source.is_file() {\n        return Err(anyhow!(\"{} não é um arquivo\", source.display()));\n    }\n    let name = source\n        .file_name()\n        .and_then(|s| s.to_str())\n        .unwrap_or_default();\n    if !is_runtime_lib(name) {\n        return Err(anyhow!(\n            \"{} não parece a biblioteca do ONNX Runtime deste sistema (esperava algo como {})\",\n            name,\n            lib_filename()\n        ));\n    }\n    let dir = target_dir().ok_or_else(|| anyhow!(\"não achei o diretório de dados do app\"))?;\n    std::fs::create_dir_all(&dir).with_context(|| format!(\"criando {}\", dir.display()))?;\n    let bytes = std::fs::read(source).with_context(|| format!(\"lendo {}\", source.display()))?;\n    let dest = write_atomic(&dir, lib_filename(), &bytes)?;\n    if let Some(marker) = version_marker_path() {\n        let _ = std::fs::write(&marker, format!(\"local ({name})\"));\n    }\n    Ok(dest)\n}\n\n/// Apaga a lib gerida (a apontada por env var não é nossa para mexer).\npub fn remove_managed() -> anyhow::Result<()> {\n    let dir = target_dir().ok_or_else(|| anyhow!(\"não achei o diretório de dados do app\"))?;","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/onnxrt.rs#L505-L541","documentation":"Raised by install_from_path() when the file exists but its name fails is_runtime_lib(name) — it does not look like the ONNX Runtime shared library expected on this OS (lib_filename(), e.g. libonnxruntime.so/.dylib/onnxruntime.dll). The library refuses to install arbitrary files that would never load at init.","triggerScenarios":"install_from_path() given a renamed library (libonnxruntime.1.22.0.so kept but expected canonical name missing markers), a different library (e.g. libprotobuf.so), or a non-ELF file with a similar name on a mismatched platform.","commonSituations":"User picks the versioned lib instead of the base name; picked a Windows .dll while running on Linux; downloaded an onnxruntime build for the wrong OS so the filename differs; library renamed by a package manager.","solutions":["Point to the canonical library name for this OS (libonnxruntime.so / libonnxruntime.dylib / onnxruntime.dll)","Take the lib from the pip onnxruntime package (capi/ directory) for the current platform","Rename the file to the canonical name if it is genuinely the right lib for this OS","Ensure the download/platform matches the running OS/arch before installing"],"exampleFix":"// before\nonnxrt::install_from_path(Path::new(\"libonnxruntime.1.22.0.so\"))?; // rejected\n// after\nstd::fs::copy(\"libonnxruntime.1.22.0.so\", \"libonnxruntime.so\")?;\nonnxrt::install_from_path(Path::new(\"libonnxruntime.so\"))?;","handlingStrategy":"validation","validationCode":"let name = src.file_name().unwrap().to_string_lossy(); if !name.starts_with(\"libonnxruntime\") && name != \"onnxruntime.dll\" { return Err(anyhow!(\"wrong library\")); }","typeGuard":"fn looks_like_runtime_lib(p: &std::path::Path) -> bool { p.file_name().map(|n| n.to_string_lossy().contains(\"onnxruntime\")).unwrap_or(false) }","tryCatchPattern":"match install_from_path(&p) { Err(e) if e.to_string().contains(\"não parece a biblioteca\") => suggest_pip_package(), ... }","preventionTips":["Match the library to the running OS before install","Use the canonical filename (lib_filename())","Source libs from the pip onnxruntime package for the current platform"],"tags":["onnx","rust","validation","filename"],"backgroundTag":"invalid-argument-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"}