{"record":{"id":"f467f7ce8d2c98d3","repo":"jdx/mise","slug":"cannot-connect-a-setup-repository-reason","errorCode":null,"errorMessage":"cannot connect a setup repository: {reason}","messagePattern":"cannot connect a setup repository: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/dotfiles/origin.rs","lineNumber":103,"sourceCode":"        let mode = match self.sync.as_deref() {\n            Some(mode) => SyncMode::parse(mode)?,\n            None if self.yes || crate::config::Settings::get().yes => SyncMode::current()?,\n            None => match crate::ui::prompt::confirm_with_default(\n                \"Automatically publish saved edits AND apply incoming changes to live files? Choose no for manual sharing; local autosave continues in either mode.\",\n                false,\n            )? {\n                crate::ui::prompt::Confirmation::Yes => SyncMode::Sync,\n                crate::ui::prompt::Confirmation::No => SyncMode::Manual,\n                crate::ui::prompt::Confirmation::Unavailable => {\n                    bail!(\n                        \"not connected: choose --sync manual, --sync sync, or --sync fetch-only to connect without a mode prompt\"\n                    );\n                }\n            },\n        };\n        let (store, tracked, _) = super::history::open().await?;\n        if let Some(reason) = store.unavailable() {\n            bail!(\"cannot connect a setup repository: {reason}\");\n        }\n        origin::set(\n            &store,\n            &tracked,\n            &origin::SetOptions {\n                url: self.url.clone(),\n                branch: self.branch.clone(),\n                mode,\n                yes: self.yes,\n            },\n        )\n        .await\n    }\n}\n\nstatic AFTER_LONG_HELP: &str = color_print::cstr!(\n    r#\"<bold><underline>Examples:</underline></bold>\n","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/dotfiles/origin.rs#L85-L121","documentation":"Thrown by `mise bootstrap dotfiles origin` (run) after opening the history store when `store.unavailable()` reports the repository is still in a setup/incomplete state. A setup repository has no usable history state yet, so it cannot be connected to a remote origin.","triggerScenarios":"Calling `mise bootstrap dotfiles origin <url>` before the dotfiles history store has completed its initial setup; store.unavailable() returns Some(reason) right after history::open().","commonSituations":"Users who enabled dotfile tracking but never finished the initial history setup/bootstrap; corrupted or partially initialized history state directory; running origin connect on a fresh machine before the first history capture.","solutions":["Finish the initial dotfiles setup first (complete the bootstrap/history setup steps indicated by the reason)","Inspect the reported reason: `mise bootstrap dotfiles history --pending` to see incomplete operations","Initialize the history store (`mise bootstrap dotfiles` setup flow) before connecting an origin","Recover or clear pending interrupted operations with `mise bootstrap dotfiles history --recover`"],"exampleFix":"// before (setup incomplete)\nmise bootstrap dotfiles origin git@github.com:me/dotfiles.git\n// after (finish setup first)\nmise bootstrap dotfiles  # complete initial setup\nmise bootstrap dotfiles origin git@github.com:me/dotfiles.git","handlingStrategy":"validation","validationCode":"# Ensure no pending setup operations remain before connecting an origin\nmise bootstrap dotfiles history --pending || true\n# proceed with origin connect only if the list is empty","typeGuard":null,"tryCatchPattern":"if ! mise bootstrap dotfiles origin --sync sync \"$URL\"; then\n  echo \"complete dotfiles setup before connecting origin\" >&2\n  mise bootstrap dotfiles history --pending\n  exit 1\nfi","preventionTips":["Complete the initial dotfiles bootstrap on every new machine before origin connect","Run history --pending as a pre-check in setup scripts","Keep the history state directory intact; avoid manual deletion of state files"],"tags":["cli","dotfiles","setup","invalid-state"],"backgroundTag":"invalid-state-transition","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"}