{"record":{"id":"9bc6a69329d7a24c","repo":"tonhowtf/omniget","slug":"busca-falhou","errorCode":null,"errorMessage":"busca falhou: {}","messagePattern":"busca falhou: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/file_search.rs","lineNumber":137,"sourceCode":"            .await\n            .or(crate::core::dependencies::find_tool(\"fdfind\").await);\n        output = match fd {\n            Some(fd) => {\n                crate::core::process::command(&fd)\n                    .args([\"-i\", \"--max-results\", &limit.to_string(), q, &root])\n                    .output()\n                    .await?\n            }\n            None => {\n                crate::core::process::command(\"find\")\n                    .args([&root, \"-iname\", &format!(\"*{}*\", q)])\n                    .output()\n                    .await?\n            }\n        };\n    }\n    if !output.status.success() && output.stdout.is_empty() {\n        return Err(anyhow!(\n            \"busca falhou: {}\",\n            String::from_utf8_lossy(&output.stderr).trim()\n        ));\n    }\n    let text = String::from_utf8_lossy(&output.stdout);\n    let hits = text\n        .lines()\n        .map(|l| l.trim().trim_end_matches('\\r'))\n        .filter(|l| !l.is_empty())\n        .take(limit)\n        .map(|l| {\n            let meta = std::fs::metadata(l).ok();\n            Hit {\n                path: l.to_string(),\n                size: meta.as_ref().filter(|m| m.is_file()).map(|m| m.len()),\n                is_dir: meta.map(|m| m.is_dir()).unwrap_or(false),\n            }\n        })","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/file_search.rs#L119-L155","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the stderr text embedded in the error — it contains the subprocess's actual failure reason","Check that the Everything service is running (Everything app open) on Windows","Retry with a simpler query and a valid folder path to isolate the cause"],"exampleFix":"// before\nlet hits = file_search::search(&q, folder, limit).await?;\n// after\nlet hits = file_search::search(&q, folder, limit).await\n    .map_err(|e| anyhow!(\"busca de arquivos falhou: {e}\"))?;","handlingStrategy":"try-catch","validationCode":"// ensure the folder exists before searching\nif !folder.trim().is_empty() && !std::path::Path::new(folder.trim()).exists() {\n    return Err(anyhow!(\"pasta inexistente: {folder}\"));\n}","typeGuard":null,"tryCatchPattern":"match file_search::search(&q, folder, limit).await {\n    Ok(hits) => hits,\n    Err(e) => {\n        log::warn!(\"busca falhou: {e}\");\n        Vec::new() // degrade to empty results\n    }\n}","preventionTips":["Keep the Everything service running; validate before searching","Sanitize/escape query strings passed to es.exe","Validate the folder argument exists and is a directory first"],"tags":["subprocess","file-search","stderr"],"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-16T04:17:20.429Z"}