{"record":{"id":"ca626891a58090f1","repo":"Hmbown/CodeWhale","slug":"search-root-does-not-exist","errorCode":null,"errorMessage":"search root does not exist: {}","messagePattern":"search root does not exist: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/eval.rs","lineNumber":622,"sourceCode":"fn read_workspace_file(path: &Path) -> Result<String> {\n    fs::read_to_string(path).with_context(|| format!(\"failed to read {}\", path.display()))\n}\n\n#[derive(Debug, Clone, PartialEq, Eq)]\nstruct SearchMatch {\n    path: PathBuf,\n    line: usize,\n    content: String,\n}\n\n#[derive(Debug, Clone, PartialEq, Eq)]\nstruct SearchResult {\n    matches: Vec<SearchMatch>,\n}\n\nfn search_files(root: &Path, pattern: &str) -> Result<SearchResult> {\n    if !root.exists() {\n        return Err(anyhow!(\"search root does not exist: {}\", root.display()));\n    }\n\n    let regex = Regex::new(pattern).context(\"failed to compile search regex\")?;\n    let mut matches = Vec::new();\n\n    let walker = WalkBuilder::new(root)\n        .hidden(false)\n        .git_ignore(false)\n        .git_global(false)\n        .git_exclude(false)\n        .build();\n\n    for entry in walker {\n        let entry = entry.with_context(|| format!(\"failed to walk {}\", root.display()))?;\n        if !entry.file_type().is_some_and(|t| t.is_file()) {\n            continue;\n        }\n","sourceCodeStart":604,"sourceCodeEnd":640,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/eval.rs#L604-L640","documentation":"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.","triggerScenarios":"run() invokes search_files with a root Path that does not exist on disk (workspace never initialized, deleted between steps, or wrong path constructed).","commonSituations":"Eval workspace cleanup removed the directory before a later search step; misconfigured workspace root path; relative path resolved against an unexpected cwd.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if !root.exists() {\n    eprintln!(\"workspace root {} missing; run setup first\", root.display());\n    return;\n}","typeGuard":null,"tryCatchPattern":"match search_files(&root, pattern) {\n    Err(e) if e.to_string().starts_with(\"search root does not exist\") => {\n        recreate_workspace(&root)?;\n        search_files(&root, pattern)?\n    }\n    other => other?,\n}","preventionTips":["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."],"tags":["filesystem","search","path"],"backgroundTag":"directory-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}