Hmbown/CodeWhale · error · anyhow::Error
search root does not exist
Error message
search root does not exist: {} What it means
search_files walks the eval workspace root with the ignore crate's WalkBuilder to run regex searches. Before walking it checks that the root path exists; if not, it fails with the path's display form. This guards against searching a deleted or never-created workspace directory.
Solutions
- Check the printed root path exists; create the workspace or correct the configured root.
- Ensure earlier eval steps (workspace setup) ran before the search step.
- Use an absolute path for the workspace root to avoid cwd-dependent resolution.
Defensive patterns
Strategy: validation
Validate before calling
if !root.exists() {
eprintln!("workspace root {} missing; run setup first", root.display());
return;
} Try / catch
match search_files(&root, pattern) {
Err(e) if e.to_string().starts_with("search root does not exist") => {
recreate_workspace(&root)?;
search_files(&root, pattern)?
}
other => other?,
} Prevention
- Create the workspace directory before any eval step that reads it.
- Use absolute paths for the workspace root.
- Don't delete the workspace between steps of a single run.
When it happens
Trigger: run() invokes search_files with a root Path that does not exist on disk (workspace never initialized, deleted between steps, or wrong path constructed).
Common situations: Eval workspace cleanup removed the directory before a later search step; misconfigured workspace root path; relative path resolved against an unexpected cwd.
Related errors
- Codewhale credentials directory cannot be a volume root
- Codewhale-owned xAI OAuth path has the wrong filesystem type
- continual harness state has no parent
- external credential path must resolve to an absolute path
- invalid on-disk package directory for skill
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/ca626891a58090f1.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/eval.rs:622
fn read_workspace_file(path: &Path) -> Result<String> {
fs::read_to_string(path).with_context(|| format!("failed to read {}", path.display()))
}
#[derive(Debug, Clone, PartialEq, Eq)]
struct SearchMatch {
path: PathBuf,
line: usize,
content: String,
}
#[derive(Debug, Clone, PartialEq, Eq)]
struct SearchResult {
matches: Vec<SearchMatch>,
}
fn search_files(root: &Path, pattern: &str) -> Result<SearchResult> {
if !root.exists() {
return Err(anyhow!("search root does not exist: {}", root.display()));
}
let regex = Regex::new(pattern).context("failed to compile search regex")?;
let mut matches = Vec::new();
let walker = WalkBuilder::new(root)
.hidden(false)
.git_ignore(false)
.git_global(false)
.git_exclude(false)
.build();
for entry in walker {
let entry = entry.with_context(|| format!("failed to walk {}", root.display()))?;
if !entry.file_type().is_some_and(|t| t.is_file()) {
continue;
}
View on GitHub (pinned to 73e0f67d83)