{"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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/lib.rs","lineNumber":1139,"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":1121,"sourceCodeEnd":1157,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/cli/src/lib.rs#L1121-L1157","documentation":"Thrown while resolving a workflow by name: `resolve_workflow_source_path` builds an ordered candidate list (explicit `--source` path, or `workflows/<name>.workflow.js` and its dash-to-underscore variant under the workspace root) and none of them is an existing file. The message lists every path tried, so you can see exactly which locations were probed.","triggerScenarios":"Running a workflow with a misspelled name; running from the wrong working directory so `workflows/` resolves against the wrong workspace root; referencing `my-flow` when the file is named `my_flow.workflow.js` in a non-default directory; passing a relative `--source` that lands outside the workspace.","commonSituations":"Renamed a workflow file but not the CLI invocation; project moved and the workspace root changed; hyphen vs underscore mismatch; workflow file has a different extension (`.js` vs `.ts`) than expected; CI checkout that excludes the workflows directory.","solutions":["Check the 'tried' paths in the error message and rename or move your file to match one of them (typically `workflows/<name>.workflow.js` at the workspace root)","Pass an explicit path: use the `--source` flag with the absolute or workspace-relative file path","Run `codewhale` from the intended workspace root so relative `workflows/` resolution is correct","Fix hyphen/underscore or extension mismatches (`my-flow` also probes `my_flow.workflow.js`, but not `my-flow.js`)"],"exampleFix":"# before\n$ codewhale workflow run build-checks\n# workflow source for `build-checks` not found; tried /repo/workflows/build-checks.workflow.js, /repo/workflows/build_checks.workflow.js\n\n# after: point at the real file\n$ codewhale workflow run build-checks --source tools/checks.workflow.js","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# resolve the workflow file the same way codewhale does before invoking\nname=\"build-checks\"\nfor f in \"workflows/$name.workflow.js\" \"workflows/${name//-/_}.workflow.js\"; do\n  [ -f \"$f\" ] && exec codewhale workflow run \"$name\"\ndone\necho \"workflow '$name' not found under workflows/\" >&2; exit 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin workflows in CI with an explicit `--source <path>` instead of name resolution","Name files `<name>.workflow.js` directly under the workspace `workflows/` directory","Run codewhale from the workspace root; check the error's 'tried' list to see which root was used"],"tags":["workflow","file-resolution","workspace","cli"],"backgroundTag":"file-not-found","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}