nikivdev/code · error
recipe '{}' failed with status {}
Error message
recipe '{}' failed with status {} What it means
`run_recipe` bails when a shell-based recipe (`RecipeRunner` shell variant) finishes with a non-zero exit status. The error is intentional pass-through of the recipe's own failure so the CLI exit code reflects the script's outcome.
Source
Thrown at src/recipe.rs:158
let shell_bin = resolve_shell_bin(shell);
let shell_cmd = command.trim();
println!("engine: shell");
println!("shell: {}", shell_bin);
println!("cmd: {}", shell_cmd);
if opts.dry_run {
return Ok(());
}
let status = Command::new(&shell_bin)
.arg("-lc")
.arg(shell_cmd)
.current_dir(&cwd)
.status()
.with_context(|| format!("failed to run recipe command via {}", shell_bin))?;
if !status.success() {
bail!("recipe '{}' failed with status {}", recipe.id, status);
}
}
RecipeRunner::MoonbitFile => {
println!("engine: moonbit");
println!("cmd: moon run {}", recipe.path.display());
if opts.dry_run {
return Ok(());
}
let status = Command::new("moon")
.arg("run")
.arg(&recipe.path)
.current_dir(&cwd)
.status()
.with_context(|| format!("failed to run moon recipe {}", recipe.path.display()))?;
if !status.success() {View on GitHub (pinned to a747e741ae)
Solutions
- Read the script output printed just before the error to see the underlying failure and fix it
- Run the recipe's command manually in the same cwd to reproduce and debug
- Install or PATH-enable the tools the recipe script depends on
- Pass/verify the correct cwd when invoking run_recipe so relative paths resolve
- Set the recipe to use an explicit shell (e.g. bash) if it uses bash-only syntax
Example fix
// before: recipe command `npm test` fails Error: recipe 'ci-checks' failed with status exit status: 1 // after $ npm test # run manually; a test in src/app.spec.ts fails $ fix test... && f recipe run ci-checks
Defensive patterns
Strategy: try-catch
Validate before calling
// preflight: verify the underlying command works before running the recipe
// (adjust to the recipe's command)
if !std::process::Command::new("npm").arg("--version").status().map_or(false, |s| s.success()) {
eprintln!("npm not available; recipe will fail");
} Try / catch
match run_recipe(opts) {
Ok(()) => {},
Err(e) if e.to_string().contains("failed with status") => {
eprintln!("recipe script failed; read its output above and fix the underlying command");
std::process::exit(1); // preserve failure semantics
}
Err(e) => return Err(e),
} Prevention
- Run recipe scripts manually once before wiring them into automation
- Ensure all tools the script uses are installed and on PATH
- Verify the recipe's working directory (cwd) contains the files it expects
- Pin the shell in the recipe (bash vs sh) to avoid syntax surprises
When it happens
Trigger: Running a recipe whose shell command (executed via the configured shell_bin with cwd = resolved working dir) exits non-zero: build failures, failing tests, missing binaries inside the script, script syntax errors.
Common situations: Recipe scripts assuming tools that aren't installed or not on PATH; running the recipe from the wrong working directory so relative paths break; test/lint failures in the underlying project; shell differences (script written for bash run under sh).
Related errors
- resolver {} failed for {}: {}
- git config --global {} failed
- Lin.app is not running
- gen agent list failed
- gen agent list failed: {}
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/f48d613999810b81.
Report an issue: GitHub.