{"record":{"id":"2394ca718cadecc2","repo":"nikivdev/code","slug":"prek-pre-push-validation-failed","errorCode":null,"errorMessage":"prek pre-push validation failed","messagePattern":"prek pre-push validation failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/push_hook.rs","lineNumber":392,"sourceCode":"        cmd.env(\"FLOW_PUSH_CURRENT_BRANCH\", branch);\n    }\n    if let Some(branch) = home_branch\n        && !branch.trim().is_empty()\n    {\n        cmd.env(\"FLOW_PUSH_HOME_BRANCH\", branch);\n    }\n\n    let status = cmd.status().with_context(|| {\n        format!(\n            \"failed to run prek pre-push validation via {}\",\n            prek_bin.display()\n        )\n    })?;\n    if status.success() {\n        return Ok(());\n    }\n\n    bail!(\"prek pre-push validation failed\")\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn rendered_hook_script_mentions_internal_eval_command() {\n        let script = render_pre_push_hook_script();\n        assert!(script.contains(\"push hook-eval\"));\n        assert!(script.contains(FLOW_PRE_PUSH_HOOK_MARKER));\n        assert!(script.contains(\"legacy_hook\"));\n        assert!(script.contains(\"same_path\"));\n    }\n}\n","sourceCodeStart":374,"sourceCodeEnd":408,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/push_hook.rs#L374-L408","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n$ git push\n# prek pre-push validation failed\n// after\n$ prek run --all-files   # shows rustfmt failure in src/lib.rs\n$ cargo fmt && git commit --amend --no-edit\n$ git push","handlingStrategy":"retry","validationCode":"// preflight: run the same validation before pushing\nlet ok = std::process::Command::new(\"prek\")\n    .args([\"run\", \"--all-files\"])\n    .status()\n    .map(|s| s.success())\n    .unwrap_or(false);\nif !ok { eprintln!(\"fix prek findings before pushing\"); }","typeGuard":null,"tryCatchPattern":"match run_hook_eval(...) {\n    Ok(()) => {},\n    Err(e) if e.to_string().contains(\"prek pre-push validation failed\") => {\n        eprintln!(\"prek checks failed; run `prek run --all-files` locally, fix, then push again\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["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"],"tags":["prek","validation","exit-status","git-hooks"],"backgroundTag":"pre-push-validation-failed","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}