{"record":{"id":"69135ccd18063105","repo":"nikivdev/code","slug":"error-69135c","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/push_hook.rs","lineNumber":48,"sourceCode":"    let policy = push_policy::load_merged_push_policy(&repo_root)?;\n    let current_branch = current_branch(&repo_root)?;\n    let updates = push_policy::parse_pre_push_updates(&input);\n    let decision = push_policy::evaluate_pre_push(\n        &PushContext {\n            repo_root: repo_root.clone(),\n            current_branch: current_branch.clone(),\n            remote_name: cmd.remote_name.clone(),\n            remote_url: cmd.remote_url.clone(),\n            updates,\n            orchestrated: env::var(\"FLOW_PUSH_ORCHESTRATED\")\n                .map(|value| value == \"1\")\n                .unwrap_or(false),\n        },\n        &policy,\n    );\n\n    if !decision.allow {\n        bail!(\n            \"{}\",\n            decision\n                .message\n                .unwrap_or_else(|| \"push denied by Flow push policy\".to_string())\n        )\n    }\n\n    if decision.policy.run_prek {\n        run_prek_validation(\n            &repo_root,\n            &policy,\n            cmd.remote_name.as_deref(),\n            cmd.remote_url.as_deref(),\n            current_branch.as_deref(),\n            decision.policy.home_branch.as_deref(),\n        )?;\n    }\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/push_hook.rs#L30-L66","documentation":"Raised by run_hook_eval in src/push_hook.rs when the Flow push policy evaluation returns allow=false for the pre-push context. The hook aborts the push (this binary runs as the git pre-push hook), printing either the policy's custom message or the default 'push denied by Flow push policy'.","triggerScenarios":"A git push triggers the Flow pre-push hook; evaluate_pre_push returns a deny decision based on the merged push policy (e.g. pushing to a branch that is not the policy's home_branch, pushing from an unorchestrated context when required, or remote/branch restrictions).","commonSituations":"Developer pushing directly to a protected/home branch instead of a feature branch; FLOW_PUSH_ORCHESTRATED env var not set when the policy requires orchestrated pushes; pushing to the wrong remote; policy config file tightened by the team.","solutions":["Read the denial message printed by the error — it may name the violated policy rule","Push to the branch/remote the policy allows (e.g. open a PR targeting home_branch instead of pushing to it directly)","If the push is meant to be orchestrated, set FLOW_PUSH_ORCHESTRATED=1 as required, or adjust the push policy config if the rule is outdated"],"exampleFix":"// before: denied direct push to main\n$ git push origin main\npush denied by Flow push policy\n// after\n$ git checkout -b feature/x && git push origin feature/x","handlingStrategy":"try-catch","validationCode":"// check the effective policy before pushing\n// f push hooks status / inspect the policy file for home_branch and orchestrated requirements\nif std::env::var(\"FLOW_PUSH_ORCHESTRATED\").as_deref() != Ok(\"1\")\n    && policy_requires_orchestration {\n    eprintln!(\"policy requires orchestrated pushes; set FLOW_PUSH_ORCHESTRATED=1\");\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"push denied by Flow push policy\")\n        || e.to_string().contains(\"denied\") => {\n        eprintln!(\"push blocked by policy: {}\", e);\n        // switch to the allowed branch/remote or adjust policy\n    }\n    Err(e) => return Err(e),\n    Ok(v) => Ok(v),\n}","preventionTips":["Read the denial message — it names the violated rule","Push feature branches instead of home/protected branches directly","Set FLOW_PUSH_ORCHESTRATED=1 when the workflow requires it"],"tags":["policy","pre-push-hook","denied"],"backgroundTag":"push-policy-denied","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}