jdx/mise · error

publication kept being rejected after

Error message

publication kept being rejected after {attempts} attempts: {reason}

What it means

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.

Solutions

  1. Wait for the competing sync/push to finish, then re-run `mise dot sync`.
  2. Check remote-side blockers: branch protection, permissions, or hooks rejecting the push, and fix or request access.
  3. Investigate the reported `reason` — if it is a persistent non-fast-forward from another machine, coordinate which machine syncs first.
  4. If the remote moved intentionally, `mise dot pull` to reconcile, then sync again.

Example fix

// before: two machines pushing concurrently
mise dot sync // error: publication kept being rejected after 3 attempts
// after: serialize the writers
# on machine A: mise dot sync (finish first)
# on machine B: then
mise dot sync
Defensive patterns

Strategy: retry

Validate before calling

// check for competing pushers/permissions before syncing
assert!(can_push_to(origin.url, origin.branch), "no push access or branch protected");

Try / catch

match sync() {
    Err(e) if e.to_string().contains("publication kept being rejected") => { wait_for_quiescence(); pull(); sync(); }
    other => other,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/da3aaef091728043. Report an issue: GitHub.

Appendix: source

Thrown at src/system/history/sync/run.rs:423

                        request.capture && console::user_attended_stderr(),
                    )?;
                    plans = prepare(
                        repo,
                        tracked,
                        &shared.objects(),
                        &upstream,
                        &unsaved,
                        &mut status,
                    )?;
                    break;
                }
                PushOutcome::Rejected(reason) if attempts < PUSH_RETRIES => {
                    debug!("history sync: publication rejected, fetching again: {reason}");
                    remote.fetch(&origin.branch)?;
                    upstream_commit = repo.ref_oid(UPSTREAM_REF)?;
                }
                PushOutcome::Rejected(reason) => {
                    bail!("publication kept being rejected after {attempts} attempts: {reason}")
                }
            }
        }
        status.upstream_commit = upstream_commit.clone();
        record_pending(&mut status, &plans, &Roots::current(), &shared.objects());
        outcome.pending =
            status.pending_applications.len() + usize::from(status.pending_repository);
        outcome.conflicts = status.conflicts.len();
        status.last_error = None;
        status.failing_since = None;
        status.consecutive_failures = 0;
        status.backoff_until = None;
        if !request.dry_run {
            notify_new_conflicts(&mut status);
        }
        Ok(())
    })();
    if let Err(err) = &result {

View on GitHub (pinned to 533346cc37)