tonhowtf/omniget · error · anyhow

tesseract nao esta instalado

Error message

tesseract nao esta instalado

What it means

`ocr::run` calls `locate()` which searches the system for the `tesseract` binary (first via the dependency finder, then a fixed list of standard install paths). If no executable is found, it aborts with 'tesseract nao esta instalado'. The app shells out to the system Tesseract instead of bundling it, so OCR is simply unavailable when the binary is not on disk.

Solutions

  1. Install tesseract with the documented command: `brew install tesseract tesseract-lang` (macOS), `sudo apt install tesseract-ocr tesseract-ocr-por` (Linux), or `winget install UB-Mannheim.TesseractOCR` (Windows).
  2. Verify `which tesseract` / `where tesseract` resolves; if not, symlink the binary into one of the probed paths (e.g. /usr/local/bin).
  3. Call the status() endpoint first (it returns `installed` and an `install_hint`) and surface the hint to the user instead of calling run().

Example fix

// before
let results = ocr::run(&[path], "eng", progress).await?;
// after
if !ocr::status().await.installed {
    return Err(anyhow!("instale o tesseract: {}", ocr::status().await.install_hint));
}
let results = ocr::run(&[path], "eng", progress).await?;
Defensive patterns

Strategy: fallback

Validate before calling

let status = ocr::status().await;
if !status.installed {
    return Err(anyhow!("OCR indisponível: instale com {}", status.install_hint));
}

Type guard

async fn tesseract_available() -> bool {
    ocr::status().await.installed
}

Try / catch

match ocr::run(&inputs, langs, progress).await {
    Ok(results) => results,
    Err(e) if e.to_string().contains("nao esta instalado") => {
        eprintln!("instale o tesseract primeiro");
        Vec::new()
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling `run`, or any of its callers share_file/share_url/share_text/ping/refresh, on a machine where tesseract is not installed or is installed outside the probed paths (`/opt/homebrew/bin`, `/usr/local/bin`, `/usr/bin`, `C:\Program Files\Tesseract-OCR\`).

Common situations: Fresh dev machines or CI containers without tesseract; non-standard installs (e.g. custom prefix, snap, Homebrew on Apple Silicon vs Intel mismatches handled only for the two homebrew paths); Windows installs via other package managers that don't put tesseract.exe in Program Files.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/ocr.rs:101

        languages,
        install_hint: hint,
    }
}

#[derive(Debug, Clone, Serialize)]
pub struct OcrResult {
    pub path: String,
    pub text: String,
}

pub async fn run(
    inputs: &[String],
    langs: &str,
    progress: super::ProgressFn,
) -> anyhow::Result<Vec<OcrResult>> {
    let bin = locate()
        .await
        .ok_or_else(|| anyhow!("tesseract nao esta instalado"))?;
    let langs = if langs.trim().is_empty() {
        "eng"
    } else {
        langs.trim()
    };
    let mut out = Vec::new();
    let total = inputs.len() as u64;
    for (i, input) in inputs.iter().enumerate() {
        super::report(
            &progress,
            "ocr",
            "progress",
            i as u64,
            Some(total),
            Some(input.clone()),
        );
        let o = crate::core::process::command(&bin)
            .arg(input)

View on GitHub (pinned to 8600b91f42)