{"record":{"id":"9b848700c640fad3","repo":"jdx/mise","slug":"cannot-determine-whether-url-is-a-setup-reposito","errorCode":null,"errorMessage":"cannot determine whether {url} is a setup repository: {reason}","messagePattern":"cannot determine whether (.+?) is a setup repository: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/onboard.rs","lineNumber":145,"sourceCode":"    let Some(enrolled) = tracked.entry_for(local) else {\n        return Ok(None);\n    };\n    Ok(\n        (enrolled.tree_path(local)? == branch_path && tracked.would_capture(local)?)\n            .then(|| relative.to_path_buf()),\n    )\n}\n\n/// `mise bootstrap --adopt <url>`: `Some` when the repository is\n/// history-managed and this machine was set up from it (or would be, on a\n/// dry run); `None` leaves the ordinary clone to the caller.\npub(crate) async fn from_git(url: &str, yes: bool, dry_run: bool) -> Result<Option<Outcome>> {\n    // 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 {","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/history/sync/onboard.rs#L127-L163","documentation":"from_git probes whether a remote URL is a marked setup repository by opening a temporary Store and inspecting its default branch. If the store reports itself unavailable (e.g. git missing or unusable), the probe cannot decide, so it fails with this error embedding both the URL and the reason.","triggerScenarios":"Calling from_git(url, yes, dry_run) when Store::open_in on the fresh probe tempdir reports an unavailable() reason — most commonly git not being installed or not functioning in the environment.","commonSituations":"Running the adopt/onboarding flow in a minimal container or CI image without git; a broken git binary on PATH; an environment where the temp probe directory cannot be initialized.","solutions":["Install git (or fix the broken git binary) so Store::open_in can open a working repository.","Run `git --version` to confirm git is on PATH and executable.","If git is present, inspect the store's unavailable() reason in the error message for environment-specific problems (e.g. permissions, config errors) and fix that cause.","If the URL is simply not a setup repository and git is fine, the function returns Ok(None) instead — no error — so an error here always indicates an environment problem, not a wrong URL."],"exampleFix":"// before probing in CI\nif which::which(\"git\").is_err() {\n    eprintln!(\"git is required to probe setup repositories\");\n    std::process::exit(1);\n}\nlet outcome = onboard::from_git(&url, yes, dry_run).await?;","handlingStrategy":"validation","validationCode":"// bail early with a clear message when git is missing\nif which::which(\"git\").is_err() {\n    eprintln!(\"git must be installed to probe setup repositories\");\n    std::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":"match from_git(&url, yes, dry_run).await {\n    Err(e) if e.to_string().starts_with(\"cannot determine whether\") => {\n        eprintln!(\"environment cannot probe: {} — check git availability\", e);\n    }\n    other => other?,\n}","preventionTips":["Install git in minimal containers/CI images that run the adopt flow.","Verify `git --version` works before invoking onboarding/probing commands.","Treat this error as an environment issue, not a wrong-URL issue.","Surface the embedded `reason` to users instead of retrying blindly."],"tags":["git","environment","probe","dependency"],"backgroundTag":"missing-dependency","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}