tonhowtf/omniget · error · anyhow::Error
não parece a biblioteca do ONNX Runtime deste sistema…
Error message
{} não parece a biblioteca do ONNX Runtime deste sistema (esperava algo como {}) What it means
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.
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
Example fix
// before
onnxrt::install_from_path(Path::new("libonnxruntime.1.22.0.so"))?; // rejected
// after
std::fs::copy("libonnxruntime.1.22.0.so", "libonnxruntime.so")?;
onnxrt::install_from_path(Path::new("libonnxruntime.so"))?; Defensive patterns
Strategy: validation
Validate before calling
let name = src.file_name().unwrap().to_string_lossy(); if !name.starts_with("libonnxruntime") && name != "onnxruntime.dll" { return Err(anyhow!("wrong library")); } Type guard
fn looks_like_runtime_lib(p: &std::path::Path) -> bool { p.file_name().map(|n| n.to_string_lossy().contains("onnxruntime")).unwrap_or(false) } Try / catch
match install_from_path(&p) { Err(e) if e.to_string().contains("não parece a biblioteca") => suggest_pip_package(), ... } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- escolha a pasta de destino para organizar
- informe um appid, um link da loja ou marque a biblioteca…
- pasta de origem não encontrada
- escolha a pasta da biblioteca de destino
- external_data_cache: plugin_id must not be empty
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/9a4f520a6acb3c7b.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/onnxrt.rs:523
if let Some(marker) = version_marker_path() {
let _ = std::fs::write(&marker, format!("{} ({})", RUNTIME_VERSION, asset.file));
}
strip_quarantine(&out).await;
crate::core::tools::report(progress, "onnxruntime", "done", 1, Some(1), None);
Ok(out)
}
/// Instala a partir de um arquivo que o usuário já tem no disco.
pub fn install_from_path(source: &Path) -> anyhow::Result<PathBuf> {
if !source.is_file() {
return Err(anyhow!("{} não é um arquivo", source.display()));
}
let name = source
.file_name()
.and_then(|s| s.to_str())
.unwrap_or_default();
if !is_runtime_lib(name) {
return Err(anyhow!(
"{} não parece a biblioteca do ONNX Runtime deste sistema (esperava algo como {})",
name,
lib_filename()
));
}
let dir = target_dir().ok_or_else(|| anyhow!("não achei o diretório de dados do app"))?;
std::fs::create_dir_all(&dir).with_context(|| format!("criando {}", dir.display()))?;
let bytes = std::fs::read(source).with_context(|| format!("lendo {}", source.display()))?;
let dest = write_atomic(&dir, lib_filename(), &bytes)?;
if let Some(marker) = version_marker_path() {
let _ = std::fs::write(&marker, format!("local ({name})"));
}
Ok(dest)
}
/// Apaga a lib gerida (a apontada por env var não é nossa para mexer).
pub fn remove_managed() -> anyhow::Result<()> {
let dir = target_dir().ok_or_else(|| anyhow!("não achei o diretório de dados do app"))?;View on GitHub (pinned to 8600b91f42)