{"record":{"id":"2bc9d3c2f99a2389","repo":"Hmbown/CodeWhale","slug":"workflow-source-for-workflow-not-found-tried","errorCode":null,"errorMessage":"workflow source for `{workflow}` not found; tried {}","messagePattern":"workflow source for `(.+?)` not found; tried (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/lib.rs","lineNumber":1195,"sourceCode":"            let root = PathBuf::from(root);\n            return Ok(root.canonicalize().unwrap_or(root));\n        }\n    }\n    Ok(cwd)\n}\n\nfn resolve_workflow_source_path(\n    workflow: &str,\n    source_path: Option<&PathBuf>,\n    workspace: &Path,\n) -> Result<PathBuf> {\n    let candidates = workflow_source_candidates(workflow, source_path, workspace);\n    for candidate in &candidates {\n        if candidate.is_file() {\n            return Ok(candidate.clone());\n        }\n    }\n    bail!(\n        \"workflow source for `{workflow}` not found; tried {}\",\n        candidates\n            .iter()\n            .map(|p| p.display().to_string())\n            .collect::<Vec<_>>()\n            .join(\", \")\n    )\n}\n\nfn workflow_source_candidates(\n    workflow: &str,\n    source_path: Option<&PathBuf>,\n    workspace: &Path,\n) -> Vec<PathBuf> {\n    let mut candidates = Vec::new();\n    if let Some(path) = source_path {\n        candidates.push(resolve_against_workspace(path, workspace));\n        return candidates;","sourceCodeStart":1177,"sourceCodeEnd":1213,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/lib.rs#L1177-L1213","documentation":"`resolve_workflow_source` builds an ordered list of candidate paths via `workflow_source_candidates(workflow, source_path, workspace)` and returns the first that `is_file()`. If none of the candidates exists as a regular file it bails, listing every path it tried. This exists so workflow resolution fails loudly with an actionable search trace instead of a bare NotFound downstream.","triggerScenarios":"Calling a workflow command with a `workflow` name whose source file is absent from all standard locations: explicit `--source`/`source_path` missing, no file in the workspace workflow directory, and no packaged/builtin candidate matching the name.","commonSituations":"Typo in the workflow name, workflow file lives outside the workspace directory the command was run from, a custom `source_path` points to a directory that was moved, or the workflow was renamed/deleted in a newer version.","solutions":["Check the 'tried ...' list in the message and place your workflow file at one of those paths (e.g. the workspace workflows directory).","Fix typos in the workflow name or pass an explicit source path (`--source <file>`) pointing at the real file.","Run the command from the workspace root that actually contains the workflow.","If the workflow was renamed in a newer version, use the new name or restore the file."],"exampleFix":"// before\ncodewhale workflow run deploiy\n// error: workflow source for `deploiy` not found; tried ./workflows/deploiy.toml, ...\n\n// after\ncodewhale workflow run deploy\n// or: codewhale workflow run deploy --source /path/to/deploy.toml","handlingStrategy":"validation","validationCode":"let candidates = [\"./workflows\", \"~/.config/codewhale/workflows\"];\nif !candidates.iter().any(|d| std::path::Path::new(d).join(format!(\"{workflow}.toml\")).is_file()) {\n    eprintln!(\"workflow '{workflow}' not found in known locations\");\n}","typeGuard":null,"tryCatchPattern":"match resolve_workflow_source(wf, src, ws) {\n    Err(e) if e.to_string().starts_with(\"workflow source for\") => {\n        eprintln!(\"pass --source <file> with the workflow's real path\");\n    }\n    r => r?,\n}","preventionTips":["Keep workflow files inside the workspace's expected workflow directory.","Use shell completion or `codewhale workflow list` to pick valid names.","Pass an explicit --source path in scripts instead of relying on name resolution."],"tags":["cli","workflow","path-resolution","filesystem"],"backgroundTag":"resource-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"}