jdx/mise · error
could not reuse the fetched setup preview
Error message
could not reuse the fetched setup preview
What it means
Onboarding reuses an already-fetched setup preview by copying its ref from the source repository into the destination via `git fetch`. If the fetch command exits nonzero — corrupt preview repo, missing ref, network/permission problem — mise reports it cannot reuse the fetched preview and the caller must re-fetch.
Solutions
- Re-run the onboarding/setup command so the preview is fetched fresh
- Delete the stale state dir / destination preview repo and retry
- Verify the source preview repo still exists and contains the upstream ref
Defensive patterns
Strategy: retry
Validate before calling
// verify the preview ref exists before reusing
let has_ref = destination.network(["rev-parse", "--verify", UPSTREAM_REF]).map(|o| o.status.success()).unwrap_or(false);
if !has_ref { eprintln!("preview missing; re-fetching"); } Try / catch
match result {
Err(e) if e.to_string().contains("could not reuse the fetched setup preview") => {
// drop the stale preview and re-run the fetch from scratch
}
_ => {}
} Prevention
- Re-run setup after any interrupted sync instead of reusing state
- Avoid deleting or re-cloning the preview repository mid-onboarding
- Check disk/permissions on the state dir before starting onboarding
When it happens
Trigger: seed_confirmed_fetch_locked builds a fetch of `+{UPSTREAM_REF}:{UPSTREAM_REF}` from the preview source path into the destination, and `copied.status.success()` is false.
Common situations: The preview repository was garbage-collected or re-cloned so UPSTREAM_REF is missing; filesystem permission issues in the destination repo; a partially deleted state dir after an interrupted run.
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
- origin changed while planning; reconcile again
- cannot check staged changes: git is unavailable
- cannot check staged changes in
- cannot replace local history while
- could not fetch setup repository using local Git…
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/7bd41f515d74d7fa.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/history/sync/onboard.rs:472
/// discovers newer commits and recomputes against current local state.
fn seed_confirmed_fetch(store: &Store, preview: &Store) -> Result<()> {
let _sync = run::lock(store)?;
seed_confirmed_fetch_locked(store, preview)
}
fn seed_confirmed_fetch_locked(store: &Store, preview: &Store) -> Result<()> {
let source = preview
.repo()
.ok_or_else(|| eyre::eyre!("preview requires git"))?;
let destination = store
.repo()
.ok_or_else(|| eyre::eyre!("setup requires git"))?;
let url = url::Url::from_file_path(source.dir())
.map_err(|_| eyre::eyre!("cannot address the preview repository"))?;
let refspec = format!("+{UPSTREAM_REF}:{UPSTREAM_REF}");
let copied = destination.network(["fetch", "--no-tags", "--", url.as_str(), &refspec])?;
if !copied.status.success() {
bail!("could not reuse the fetched setup preview");
}
Ok(())
}
fn detach_local_history(store: &Store) -> Result<Option<HistoryReplacement>> {
use crate::system::history::shadow::HistoryRepo;
let repo = store
.repo()
.ok_or_else(|| eyre::eyre!("setup requires git"))?;
let Some(local) = repo.ref_oid(HistoryRepo::HISTORY_REF)? else {
return Ok(None);
};
let remote = repo
.ref_oid(UPSTREAM_REF)?
.ok_or_else(|| eyre::eyre!("setup repository has no fetched branch"))?;
repo.delete_history_head(&local)?;
Ok(Some(HistoryReplacement { local, remote }))View on GitHub (pinned to 533346cc37)