jdx/mise · error

not connected: choose --sync manual, --sync sync, or --sync…

Error message

not connected: choose --sync manual, --sync sync, or --sync fetch-only to connect without a mode prompt

What it means

Same command as the Unanswered case, but for `Confirmation::Unavailable` — the prompt subsystem cannot ask at all (no interactive input available), so `mise dot origin set` bails instead of picking a sync mode implicitly.

Solutions

  1. Always pass `--sync manual|sync|fetch-only` when running non-interactively
  2. Use `--yes` to accept the default (current) mode without prompting, if that is desired
  3. Allocate a TTY (e.g. `script -qec` in CI) if you truly want the interactive prompt

Example fix

// before (in CI)
mise dot origin set $DOTFILES_URL
// after
mise dot origin set $DOTFILES_URL --sync fetch-only
Defensive patterns

Strategy: validation

Validate before calling

if [ ! -t 0 ]; then
  set -- "$@" --sync fetch-only   # non-interactive default
fi

Try / catch

if ! mise dot origin set "$URL"; then
  mise dot origin set "$URL" --sync manual
fi

Prevention

When it happens

Trigger: Running `mise dot origin set` without `--sync` and without `--yes` in an environment where prompting is unavailable (no TTY / prompts disabled), so confirm_with_default returns Unavailable.

Common situations: CI jobs and Docker containers without a TTY; IDE-embedded terminals where prompt detection fails; wrapping scripts that redirect stdin/stdout.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/90ea5d3120372913. Report an issue: GitHub.

Appendix: source

Thrown at src/cli/dotfiles/origin.rs:104

        if !crate::config::Settings::get().history.enabled {
            bail!("history is disabled (history.enabled = false)");
        }
        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::Unanswered => {
                    bail!(
                        "not connected: stdin ended before an answer; choose --sync manual, --sync sync, or --sync fetch-only"
                    );
                }
                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,
            },

View on GitHub (pinned to 533346cc37)