{"record":{"id":"d02a5acdb96bfb5c","repo":"jdx/mise","slug":"this-machine-is-connected-to-url-mise-dot-origin-remove","errorCode":null,"errorMessage":"this machine is connected to {url}; `mise dot origin --remove` disconnects it, or `mise dot origin set {origin}` moves it","messagePattern":"this machine is connected to (.+?); `mise dot origin --remove` disconnects it, or `mise dot origin set (.+?)` moves it","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/onboard.rs","lineNumber":217,"sourceCode":"        if refs.iter().any(|(_, name)| name == candidate) {\n            return Ok(Some(\n                candidate.trim_start_matches(\"refs/heads/\").to_string(),\n            ));\n        }\n    }\n    Ok(refs\n        .iter()\n        .find_map(|(_, name)| name.strip_prefix(\"refs/heads/\").map(str::to_string)))\n}\n\n/// A machine connected to another repository is not silently moved.\nfn refuse_other_connection(store: &Store, origin: &str, branch: &str) -> Result<()> {\n    let status = run::read_status(store.state_dir())?;\n    if let Some(url) = &status.origin_url\n        && !status.disconnected\n        && (url != origin || status.origin_branch.as_deref() != Some(branch))\n    {\n        bail!(\n            \"this machine is connected to {url}; `mise dot origin --remove` disconnects it, or `mise dot origin set {origin}` moves it\"\n        );\n    }\n    Ok(())\n}\n\n/// Fetches the branch into the store and says what the repository is. A\n/// format this mise does not understand is an error; an ordinary\n/// repository leaves nothing behind.\nfn probe(store: &Store, fetch_from: &str, branch: &str) -> Result<RepoState> {\n    let repo = store\n        .repo()\n        .ok_or_else(|| eyre::eyre!(\"probing a setup repository requires git\"))?;\n    Remote::new(repo, fetch_from).fetch_tip(branch)?;\n    let upstream = repo.ref_oid(UPSTREAM_REF)?;\n    let state = format::detect(repo, upstream.as_deref())?;\n    state.check()?;\n    if !matches!(state, RepoState::Marked(_)) && upstream.is_some() {","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/sync/onboard.rs#L199-L235","documentation":"mise's history sync refuses to proceed when the machine's sync state already points at a different origin repository or branch and has not been explicitly disconnected. It names the conflicting URL and tells the user how to disconnect (`mise dot origin --remove`) or move the connection (`mise dot origin set {origin}`). This guard prevents silently rebinding history sync to another repository.","triggerScenarios":"Running `mise dot origin set` or onboarding-from-git (from_git -> run) while the persisted status in the store's state dir has an origin_url that differs from the requested origin/branch, and `disconnected` is false.","commonSituations":"Repointing a machine at a fork or new remote without removing the old connection; cloning the same repo to a second branch; a leftover sync state from a previous repository after `git remote set-url`.","solutions":["Run `mise dot origin --remove` to disconnect the current origin, then reconnect","Run `mise dot origin set {origin}` to move the connection to the new origin","Delete or reset the sync state in the store's state dir if it is stale"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let status = read_status(state_dir)?;\nif let Some(url) = &status.origin_url && !status.disconnected && url != desired_origin {\n    eprintln!(\"run `mise dot origin --remove` first (connected to {url})\");\n    return;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check connection state with the status command before setting a new origin","Disconnect explicitly when moving machines between repositories","Treat 'origin already set' warnings as needing an explicit decision, not an auto-overwrite"],"tags":["git","sync","conflict","state"],"backgroundTag":"conflicting-config-options","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"}