jdx/mise · error

not connected: stdin ended before an answer; choose --sync…

Error message

not connected: stdin ended before an answer; choose --sync manual, --sync sync, or --sync fetch-only

What it means

When `mise dot origin set` needs a sync mode and prompts interactively, a `Confirmation::Unanswered` result (stdin ended without an answer) causes this bail. The library refuses to guess a sync mode when no TTY/pipe answer arrives and tells the user to pass the mode explicitly.

Solutions

  1. Pass an explicit mode: `mise dot origin set --sync manual` (or `--sync sync` / `--sync fetch-only`)
  2. Run interactively in a terminal and answer the prompt
  3. If used in scripts, always supply --sync so no prompt is attempted
  4. Set `Settings.yes` (e.g. --yes) to default to the current mode without prompting, if appropriate

Example fix

// before
mise dot origin set git@github.com:me/dotfiles.git
// after
mise dot origin set git@github.com:me/dotfiles.git --sync manual
Defensive patterns

Strategy: validation

Validate before calling

# ensure a mode is provided when stdin is not a TTY
if [ ! -t 0 ] && [ -z "$SYNC_MODE" ]; then SYNC_MODE=manual; 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` in a context where stdin closes before answering: non-interactive CI, piped stdin (`< /dev/null`), scripts, or when `--yes`/`Settings.yes` are not set so the prompt is shown.

Common situations: Automation or dotfile bootstrap scripts invoking the command non-interactively; CI runners with no TTY; Ctrl-D during the interactive prompt.

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/3e44fff394aeb68f. Report an issue: GitHub.

Appendix: source

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

    }
}

impl DotfilesOriginSet {
    async fn run(self) -> Result<()> {
        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 {

View on GitHub (pinned to 533346cc37)