{"record":{"id":"da3aaef091728043","repo":"jdx/mise","slug":"publication-kept-being-rejected-after-attempts-a","errorCode":null,"errorMessage":"publication kept being rejected after {attempts} attempts: {reason}","messagePattern":"publication kept being rejected after (.+?) attempts: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/run.rs","lineNumber":423,"sourceCode":"                        request.capture && console::user_attended_stderr(),\n                    )?;\n                    plans = prepare(\n                        repo,\n                        tracked,\n                        &shared.objects(),\n                        &upstream,\n                        &unsaved,\n                        &mut status,\n                    )?;\n                    break;\n                }\n                PushOutcome::Rejected(reason) if attempts < PUSH_RETRIES => {\n                    debug!(\"history sync: publication rejected, fetching again: {reason}\");\n                    remote.fetch(&origin.branch)?;\n                    upstream_commit = repo.ref_oid(UPSTREAM_REF)?;\n                }\n                PushOutcome::Rejected(reason) => {\n                    bail!(\"publication kept being rejected after {attempts} attempts: {reason}\")\n                }\n            }\n        }\n        status.upstream_commit = upstream_commit.clone();\n        record_pending(&mut status, &plans, &Roots::current(), &shared.objects());\n        outcome.pending =\n            status.pending_applications.len() + usize::from(status.pending_repository);\n        outcome.conflicts = status.conflicts.len();\n        status.last_error = None;\n        status.failing_since = None;\n        status.consecutive_failures = 0;\n        status.backoff_until = None;\n        if !request.dry_run {\n            notify_new_conflicts(&mut status);\n        }\n        Ok(())\n    })();\n    if let Err(err) = &result {","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/sync/run.rs#L405-L441","documentation":"Publishing the synced history can be rejected by the remote (e.g. non-fast-forward because someone else pushed). mise retries: it re-fetches the origin branch, refreshes the upstream commit, and pushes again, up to PUSH_RETRIES attempts. If every attempt is rejected, it aborts with the last rejection reason.","triggerScenarios":"Repeated PushOutcome::Rejected during publication — typically a concurrent writer keeps advancing the upstream ref so pushes stay non-fast-forward even after PUSH_RETRIES fetch-and-retry cycles.","commonSituations":"Another machine is actively syncing to the same origin branch at the same time; a hook or server-side policy permanently rejects pushes (protected branch, missing permission); a stuck loop from an upstream ref moving faster than retries can catch up.","solutions":["Wait for the competing sync/push to finish, then re-run `mise dot sync`.","Check remote-side blockers: branch protection, permissions, or hooks rejecting the push, and fix or request access.","Investigate the reported `reason` — if it is a persistent non-fast-forward from another machine, coordinate which machine syncs first.","If the remote moved intentionally, `mise dot pull` to reconcile, then sync again."],"exampleFix":"// before: two machines pushing concurrently\nmise dot sync // error: publication kept being rejected after 3 attempts\n// after: serialize the writers\n# on machine A: mise dot sync (finish first)\n# on machine B: then\nmise dot sync","handlingStrategy":"retry","validationCode":"// check for competing pushers/permissions before syncing\nassert!(can_push_to(origin.url, origin.branch), \"no push access or branch protected\");","typeGuard":null,"tryCatchPattern":"match sync() {\n    Err(e) if e.to_string().contains(\"publication kept being rejected\") => { wait_for_quiescence(); pull(); sync(); }\n    other => other,\n}","preventionTips":["Avoid multiple machines syncing to the same branch simultaneously; schedule syncs.","Verify push permissions and branch-protection rules on the origin before syncing.","Coordinate with other machines when you see repeated non-fast-forward rejections.","Pull first if you know the remote advanced."],"tags":["git","push","retry-exhausted","concurrency"],"backgroundTag":"git-command-failed","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}