nikivdev/code · error
prek pre-push validation failed
Error message
prek pre-push validation failed
What it means
`run_prek_validation` executes the `prek` binary as part of the pre-push hook and bails when the child process exits non-zero. This means prek itself ran but its checks (lint/format/hooks it manages) failed, so the push validation is treated as failed.
Source
Thrown at src/push_hook.rs:392
cmd.env("FLOW_PUSH_CURRENT_BRANCH", branch);
}
if let Some(branch) = home_branch
&& !branch.trim().is_empty()
{
cmd.env("FLOW_PUSH_HOME_BRANCH", branch);
}
let status = cmd.status().with_context(|| {
format!(
"failed to run prek pre-push validation via {}",
prek_bin.display()
)
})?;
if status.success() {
return Ok(());
}
bail!("prek pre-push validation failed")
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn rendered_hook_script_mentions_internal_eval_command() {
let script = render_pre_push_hook_script();
assert!(script.contains("push hook-eval"));
assert!(script.contains(FLOW_PRE_PUSH_HOOK_MARKER));
assert!(script.contains("legacy_hook"));
assert!(script.contains("same_path"));
}
}
View on GitHub (pinned to a747e741ae)
Solutions
- Run `prek` (or `prek run --all-files`) locally to see the concrete failing checks and fix them
- Run formatters/linters prek is configured with and commit the results
- Refresh prek environments/caches (`prek run -a` or clearing its cache dir) after tool upgrades
- Fix or prune entries in the prek config that reference unavailable tools
- Use the tool's skip/bypass mechanism deliberately (e.g. env SKIP=... or push --no-verify) only when the failure is understood
Example fix
// before $ git push # prek pre-push validation failed // after $ prek run --all-files # shows rustfmt failure in src/lib.rs $ cargo fmt && git commit --amend --no-edit $ git push
Defensive patterns
Strategy: retry
Validate before calling
// preflight: run the same validation before pushing
let ok = std::process::Command::new("prek")
.args(["run", "--all-files"])
.status()
.map(|s| s.success())
.unwrap_or(false);
if !ok { eprintln!("fix prek findings before pushing"); } Try / catch
match run_hook_eval(...) {
Ok(()) => {},
Err(e) if e.to_string().contains("prek pre-push validation failed") => {
eprintln!("prek checks failed; run `prek run --all-files` locally, fix, then push again");
}
Err(e) => return Err(e),
} Prevention
- Run prek locally (or in a pre-commit step) before every push
- Keep prek and its managed tool versions in sync with teammates (commit lock/config files)
- Refresh prek environments after toolchain upgrades
- Never blanket-bypass with --no-verify; fix findings or use explicit targeted skips
When it happens
Trigger: Calling `run_hook_eval` -> `run_prek_validation` when the prek subprocess finishes with a failing exit status: lint errors, formatting diffs, failing prek-managed hooks, or prek reporting 'no hooks configured' style failures depending on its config.
Common situations: Unformatted or lint-violating code staged for push; prek config (e.g. .pre-commit-config.yaml equivalent) referencing missing tools or versions; network fetch of hook environments failing; stale prek environment caches after a toolchain upgrade.
Related errors
- No prompt provided. Usage: f agents run {} "your prompt here
- No prompt provided for flow agent.
- external codex browser exited unsuccessfully with status {}
- agent run requires a non-empty query
- empty resolver command for {}
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/2394ca718cadecc2.
Report an issue: GitHub.