{"record":{"id":"b45686721bcce0c6","repo":"jdx/mise","slug":"cannot-onboard-this-setup-repository-history-is-u","errorCode":null,"errorMessage":"cannot onboard this setup repository: history is unavailable: {reason}","messagePattern":"cannot onboard this setup repository: history is unavailable: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/onboard.rs","lineNumber":170,"sourceCode":"    // Detect marked repositories without creating persistent tracking state\n    // for users of the released, ordinary --adopt workflow.\n    let probe_dir = tempfile::tempdir()?;\n    let store = Store::open_in(probe_dir.path())?;\n    if let Some(reason) = store.unavailable() {\n        bail!(\"cannot determine whether {url} is a setup repository: {reason}\");\n    }\n    let repo = store\n        .repo()\n        .ok_or_else(|| eyre::eyre!(\"probing a setup repository requires git\"))?;\n    let Some(branch) = default_branch(&Remote::new(repo, url))? else {\n        return Ok(None);\n    };\n    if !matches!(probe(&store, url, &branch)?, RepoState::Marked(_)) {\n        return Ok(None);\n    }\n    let store = Store::open()?;\n    if let Some(reason) = store.unavailable() {\n        bail!(\"cannot onboard this setup repository: history is unavailable: {reason}\");\n    }\n    refuse_other_connection(&store, url, &branch)?;\n    let outcome = run(\n        &store,\n        &Onboarding {\n            fetch_from: url.to_string(),\n            origin: url.to_string(),\n            branch,\n            yes,\n            dry_run,\n            replace_history,\n        },\n    )\n    .await?;\n    Ok(Some(outcome))\n}\n\n/// The branch a fresh machine takes: the repository's default branch (its","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/sync/onboard.rs#L152-L188","documentation":"After confirming via an isolated probe that the remote is a marked setup repository, from_git opens the real local Store. If that store is unavailable — the local history backend cannot operate, typically because git is missing or the local state directory cannot be initialized — onboarding cannot proceed and the error carries the underlying reason.","triggerScenarios":"Calling from_git when Store::open() then store.unavailable() returns Some(reason): git missing/broken on the actual environment (as opposed to the probe), unwritable or corrupted local history state directory, incompatible store version.","commonSituations":"git not installed on the user's machine; history state directory corrupted or owned by another user after a permission change; running in a sandbox/CI without required tooling; disk-full state dir.","solutions":["Install/repair git and confirm `git --version` works, then retry onboarding","Fix the {reason} reported for the local store — e.g. repair or reinitialize the history state directory and check its permissions","Re-run the tool in an environment where the state directory is writable (correct HOME/user, adequate disk space)"],"exampleFix":"# before (in restricted CI)\n$ mise history onboard https://host/org/repo.git\nError: cannot onboard this setup repository: history is unavailable: git executable not found\n# after (image config)\nRUN apt-get update && apt-get install -y git\n$ mise history onboard https://host/org/repo.git  # succeeds","handlingStrategy":"try-catch","validationCode":"// verify prerequisites for the real local store\nif which(\"git\").is_err() { return Err(\"git is required\"); }\nlet dir = history_state_dir()?;\nstd::fs::create_dir_all(&dir)?; // surfaces permission/disk errors early","typeGuard":null,"tryCatchPattern":"match Outcome::from_git(url) {\n    Err(e) if e.to_string().contains(\"history is unavailable\") => {\n        eprintln!(\"{e}\");\n        repair_or_reinit_local_history_store()?;\n        Outcome::from_git(url)\n    }\n    other => other,\n}","preventionTips":["Ensure git is installed on end-user machines and CI images","Keep the history state directory writable by the running user and monitor disk space","After failed runs or permission changes, validate the local store before retrying onboarding"],"tags":["git","environment","history-sync","dependency"],"backgroundTag":"missing-dependency","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"}