{"record":{"id":"3e44fff394aeb68f","repo":"jdx/mise","slug":"not-connected-stdin-ended-before-an-answer-choose-sync","errorCode":null,"errorMessage":"not connected: stdin ended before an answer; choose --sync manual, --sync sync, or --sync fetch-only","messagePattern":"not connected: stdin ended before an answer; choose --sync manual, --sync sync, or --sync fetch-only","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/dotfiles/origin.rs","lineNumber":99,"sourceCode":"    }\n}\n\nimpl DotfilesOriginSet {\n    async fn run(self) -> Result<()> {\n        if !crate::config::Settings::get().history.enabled {\n            bail!(\"history is disabled (history.enabled = false)\");\n        }\n        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::Unanswered => {\n                    bail!(\n                        \"not connected: stdin ended before an answer; choose --sync manual, --sync sync, or --sync fetch-only\"\n                    );\n                }\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 {","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/dotfiles/origin.rs#L81-L117","documentation":"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.","triggerScenarios":"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.","commonSituations":"Automation or dotfile bootstrap scripts invoking the command non-interactively; CI runners with no TTY; Ctrl-D during the interactive prompt.","solutions":["Pass an explicit mode: `mise dot origin set --sync manual` (or `--sync sync` / `--sync fetch-only`)","Run interactively in a terminal and answer the prompt","If used in scripts, always supply --sync so no prompt is attempted","Set `Settings.yes` (e.g. --yes) to default to the current mode without prompting, if appropriate"],"exampleFix":"// before\nmise dot origin set git@github.com:me/dotfiles.git\n// after\nmise dot origin set git@github.com:me/dotfiles.git --sync manual","handlingStrategy":"validation","validationCode":"# ensure a mode is provided when stdin is not a TTY\nif [ ! -t 0 ] && [ -z \"$SYNC_MODE\" ]; then SYNC_MODE=manual; fi","typeGuard":null,"tryCatchPattern":"if ! mise dot origin set \"$URL\"; then\n  mise dot origin set \"$URL\" --sync manual\nfi","preventionTips":["Always pass --sync in scripts and CI","Never rely on interactive prompts from automation","Use --yes only when defaulting to the current mode is acceptable","Test bootstrap scripts with stdin redirected from /dev/null"],"tags":["cli","dotfiles","stdin","non-interactive","prompt"],"backgroundTag":"missing-required-flag","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"}