jdx/mise · error
cannot connect a setup repository: {reason}
Error message
cannot connect a setup repository: {reason} What it means
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.
Source
Thrown at src/cli/dotfiles/origin.rs:103
let mode = match self.sync.as_deref() {
Some(mode) => SyncMode::parse(mode)?,
None if self.yes || crate::config::Settings::get().yes => SyncMode::current()?,
None => match crate::ui::prompt::confirm_with_default(
"Automatically publish saved edits AND apply incoming changes to live files? Choose no for manual sharing; local autosave continues in either mode.",
false,
)? {
crate::ui::prompt::Confirmation::Yes => SyncMode::Sync,
crate::ui::prompt::Confirmation::No => SyncMode::Manual,
crate::ui::prompt::Confirmation::Unavailable => {
bail!(
"not connected: choose --sync manual, --sync sync, or --sync fetch-only to connect without a mode prompt"
);
}
},
};
let (store, tracked, _) = super::history::open().await?;
if let Some(reason) = store.unavailable() {
bail!("cannot connect a setup repository: {reason}");
}
origin::set(
&store,
&tracked,
&origin::SetOptions {
url: self.url.clone(),
branch: self.branch.clone(),
mode,
yes: self.yes,
},
)
.await
}
}
static AFTER_LONG_HELP: &str = color_print::cstr!(
r#"<bold><underline>Examples:</underline></bold>
View on GitHub (pinned to afd2eddd3a)
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`
Example fix
// before (setup incomplete) mise bootstrap dotfiles origin git@github.com:me/dotfiles.git // after (finish setup first) mise bootstrap dotfiles # complete initial setup mise bootstrap dotfiles origin git@github.com:me/dotfiles.git
Defensive patterns
Strategy: validation
Validate before calling
# Ensure no pending setup operations remain before connecting an origin mise bootstrap dotfiles history --pending || true # proceed with origin connect only if the list is empty
Try / catch
if ! mise bootstrap dotfiles origin --sync sync "$URL"; then echo "complete dotfiles setup before connecting origin" >&2 mise bootstrap dotfiles history --pending exit 1 fi
Prevention
- 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
When it happens
Trigger: 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().
Common situations: 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.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- {target_raw}: tracked in place; pass `--mode copy` after `mi
- cannot apply: {reason}
- --changed does not accept target arguments
- at least one target or --changed is required
- --source can only be used with one target
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/f467f7ce8d2c98d3.
Report an issue: GitHub.