Hmbown/CodeWhale · error

workflow source for `{workflow}` not found; tried {}

Error message

workflow source for `{workflow}` not found; tried {}

What it means

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.

Source

Thrown at crates/cli/src/lib.rs:1139

            let root = PathBuf::from(root);
            return Ok(root.canonicalize().unwrap_or(root));
        }
    }
    Ok(cwd)
}

fn resolve_workflow_source_path(
    workflow: &str,
    source_path: Option<&PathBuf>,
    workspace: &Path,
) -> Result<PathBuf> {
    let candidates = workflow_source_candidates(workflow, source_path, workspace);
    for candidate in &candidates {
        if candidate.is_file() {
            return Ok(candidate.clone());
        }
    }
    bail!(
        "workflow source for `{workflow}` not found; tried {}",
        candidates
            .iter()
            .map(|p| p.display().to_string())
            .collect::<Vec<_>>()
            .join(", ")
    )
}

fn workflow_source_candidates(
    workflow: &str,
    source_path: Option<&PathBuf>,
    workspace: &Path,
) -> Vec<PathBuf> {
    let mut candidates = Vec::new();
    if let Some(path) = source_path {
        candidates.push(resolve_against_workspace(path, workspace));
        return candidates;

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. 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)
  2. Pass an explicit path: use the `--source` flag with the absolute or workspace-relative file path
  3. Run `codewhale` from the intended workspace root so relative `workflows/` resolution is correct
  4. Fix hyphen/underscore or extension mismatches (`my-flow` also probes `my_flow.workflow.js`, but not `my-flow.js`)

Example fix

# before
$ codewhale workflow run build-checks
# workflow source for `build-checks` not found; tried /repo/workflows/build-checks.workflow.js, /repo/workflows/build_checks.workflow.js

# after: point at the real file
$ codewhale workflow run build-checks --source tools/checks.workflow.js
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
# resolve the workflow file the same way codewhale does before invoking
name="build-checks"
for f in "workflows/$name.workflow.js" "workflows/${name//-/_}.workflow.js"; do
  [ -f "$f" ] && exec codewhale workflow run "$name"
done
echo "workflow '$name' not found under workflows/" >&2; exit 1

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/2bc9d3c2f99a2389. Report an issue: GitHub.