tonhowtf/omniget · error · anyhow::Error

o pacote não traz nenhuma biblioteca do ONNX Runtime em lib/

Error message

o pacote não traz nenhuma biblioteca do ONNX Runtime em lib/

What it means

Raised by extract_libs() during install_runtime: after scanning the extracted release package, no file under lib/ matched a runtime library (nothing entered `biggest`). The library throws it because the downloaded archive layout changed or is not the expected ONNX Runtime release asset.

Solutions

  1. Reinstall the runtime to re-download a fresh package (delete the old archive first)
  2. Check the ONNX Runtime release layout for your RUNTIME_VERSION and update extract_libs path matching
  3. Verify the downloaded archive opens correctly (unzip/tar -tf) and contains a lib/ directory
  4. Pin a known-good ONNX Runtime version in RUNTIME_VERSION

Example fix

// before
const RUNTIME_VERSION: &str = "1.22.0"; // upstream renamed lib/ to lib64
// after
const RUNTIME_VERSION: &str = "1.21.1"; // known-good layout with lib/onnxruntime.so
Defensive patterns

Strategy: retry

Validate before calling

let names = std::fs::read_dir(extract_dir.join("lib"))?.count(); if names == 0 { re_download(); }

Type guard

fn has_lib_dir(dir: &Path) -> bool { dir.join("lib").read_dir().map(|mut d| d.next().is_some()).unwrap_or(false) }

Try / catch

match install_runtime(None, &progress).await { Err(e) if e.to_string().contains("nenhuma biblioteca") => re_install_pinned_version().await, ... }

Prevention

When it happens

Trigger: install_runtime() downloaded a release asset whose archive contains no recognized shared library under a lib/ directory — asset mismatch, upstream layout change, or corrupted/partial extraction.

Common situations: GitHub release layout changed between ONNX Runtime versions (files no longer under lib/); downloading the wrong asset (e.g. headers-only or a tgz for a different platform); proxy serving an HTML error page saved as the archive.

Related errors


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

Appendix: source

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

            if !entry.header().entry_type().is_file() {
                continue;
            }
            let path = entry.path()?.to_path_buf();
            if !is_lib_entry(&path) {
                continue;
            }
            let Some(name) = path.file_name().and_then(|s| s.to_str()).map(String::from) else {
                continue;
            };
            let mut buf = Vec::new();
            entry.read_to_end(&mut buf)?;
            write_atomic(dir, &name, &buf)?;
            note(&name, buf.len() as u64);
        }
    }

    let (name, _) = biggest
        .ok_or_else(|| anyhow!("o pacote não traz nenhuma biblioteca do ONNX Runtime em lib/"))?;
    Ok(name)
}

/// Garante que o nome canônico (`libonnxruntime.dylib` etc.) existe apontando
/// para o arquivo versionado que veio no pacote.
fn make_canonical(dir: &Path, extracted: &str) -> anyhow::Result<PathBuf> {
    let canonical = dir.join(lib_filename());
    if extracted == lib_filename() {
        return Ok(canonical);
    }
    let src = dir.join(extracted);
    let tmp = dir.join(format!(".{}.tmp", lib_filename()));
    std::fs::copy(&src, &tmp)
        .with_context(|| format!("copiando {} → {}", src.display(), tmp.display()))?;
    if canonical.exists() {
        let _ = std::fs::remove_file(&canonical);
    }
    std::fs::rename(&tmp, &canonical)

View on GitHub (pinned to 8600b91f42)