tonhowtf/omniget · error

busca falhou

Error message

busca falhou: {}

What it means

After running es.exe (or the non-Windows fallback), search() checks the exit status: if the command failed AND produced no stdout, it surfaces the process's stderr as this error. Real search output always writes to stdout, so empty stdout plus failure means the search itself broke.

Solutions

  1. Read the stderr text embedded in the error — it contains the subprocess's actual failure reason
  2. Check that the Everything service is running (Everything app open) on Windows
  3. Retry with a simpler query and a valid folder path to isolate the cause

Example fix

// before
let hits = file_search::search(&q, folder, limit).await?;
// after
let hits = file_search::search(&q, folder, limit).await
    .map_err(|e| anyhow!("busca de arquivos falhou: {e}"))?;
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure the folder exists before searching
if !folder.trim().is_empty() && !std::path::Path::new(folder.trim()).exists() {
    return Err(anyhow!("pasta inexistente: {folder}"));
}

Try / catch

match file_search::search(&q, folder, limit).await {
    Ok(hits) => hits,
    Err(e) => {
        log::warn!("busca falhou: {e}");
        Vec::new() // degrade to empty results
    }
}

Prevention

When it happens

Trigger: The search subprocess exits non-zero with empty stdout — e.g. invalid query syntax, bad -path folder, Everything service not running, or the fallback tool failing.

Common situations: Everything service stopped while es.exe present; query with characters the CLI misparses; folder argument pointing to a nonexistent path; non-Windows fallback binary missing or erroring.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/file_search.rs:137

            .await
            .or(crate::core::dependencies::find_tool("fdfind").await);
        output = match fd {
            Some(fd) => {
                crate::core::process::command(&fd)
                    .args(["-i", "--max-results", &limit.to_string(), q, &root])
                    .output()
                    .await?
            }
            None => {
                crate::core::process::command("find")
                    .args([&root, "-iname", &format!("*{}*", q)])
                    .output()
                    .await?
            }
        };
    }
    if !output.status.success() && output.stdout.is_empty() {
        return Err(anyhow!(
            "busca falhou: {}",
            String::from_utf8_lossy(&output.stderr).trim()
        ));
    }
    let text = String::from_utf8_lossy(&output.stdout);
    let hits = text
        .lines()
        .map(|l| l.trim().trim_end_matches('\r'))
        .filter(|l| !l.is_empty())
        .take(limit)
        .map(|l| {
            let meta = std::fs::metadata(l).ok();
            Hit {
                path: l.to_string(),
                size: meta.as_ref().filter(|m| m.is_file()).map(|m| m.len()),
                is_dir: meta.map(|m| m.is_dir()).unwrap_or(false),
            }
        })

View on GitHub (pinned to 8600b91f42)