{"record":{"id":"3525c55355ea6dc3","repo":"tonhowtf/omniget","slug":"tesseract-nao-esta-instalado","errorCode":null,"errorMessage":"tesseract nao esta instalado","messagePattern":"tesseract nao esta instalado","errorType":"exception","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/ocr.rs","lineNumber":101,"sourceCode":"        languages,\n        install_hint: hint,\n    }\n}\n\n#[derive(Debug, Clone, Serialize)]\npub struct OcrResult {\n    pub path: String,\n    pub text: String,\n}\n\npub async fn run(\n    inputs: &[String],\n    langs: &str,\n    progress: super::ProgressFn,\n) -> anyhow::Result<Vec<OcrResult>> {\n    let bin = locate()\n        .await\n        .ok_or_else(|| anyhow!(\"tesseract nao esta instalado\"))?;\n    let langs = if langs.trim().is_empty() {\n        \"eng\"\n    } else {\n        langs.trim()\n    };\n    let mut out = Vec::new();\n    let total = inputs.len() as u64;\n    for (i, input) in inputs.iter().enumerate() {\n        super::report(\n            &progress,\n            \"ocr\",\n            \"progress\",\n            i as u64,\n            Some(total),\n            Some(input.clone()),\n        );\n        let o = crate::core::process::command(&bin)\n            .arg(input)","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/ocr.rs#L83-L119","documentation":"`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.","triggerScenarios":"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\\`).","commonSituations":"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.","solutions":["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).","Verify `which tesseract` / `where tesseract` resolves; if not, symlink the binary into one of the probed paths (e.g. /usr/local/bin).","Call the status() endpoint first (it returns `installed` and an `install_hint`) and surface the hint to the user instead of calling run()."],"exampleFix":"// before\nlet results = ocr::run(&[path], \"eng\", progress).await?;\n// after\nif !ocr::status().await.installed {\n    return Err(anyhow!(\"instale o tesseract: {}\", ocr::status().await.install_hint));\n}\nlet results = ocr::run(&[path], \"eng\", progress).await?;","handlingStrategy":"fallback","validationCode":"let status = ocr::status().await;\nif !status.installed {\n    return Err(anyhow!(\"OCR indisponível: instale com {}\", status.install_hint));\n}","typeGuard":"async fn tesseract_available() -> bool {\n    ocr::status().await.installed\n}","tryCatchPattern":"match ocr::run(&inputs, langs, progress).await {\n    Ok(results) => results,\n    Err(e) if e.to_string().contains(\"nao esta instalado\") => {\n        eprintln!(\"instale o tesseract primeiro\");\n        Vec::new()\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Check ocr::status().installed before offering OCR features in the UI and show install_hint.","Pin tesseract in dev/CI images (apt/brew install) so environments mirror production.","If you control deployment, symlink or copy tesseract into one of the probed paths (/usr/local/bin or Program Files)."],"tags":["ocr","missing-binary","tesseract","external-tool"],"backgroundTag":"command-not-found","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"}