{"record":{"id":"434740b8eb08d6fa","repo":"plandex-ai/plandex","slug":"failed-to-get-confirmation-user-input-s","errorCode":null,"errorMessage":"failed to get confirmation user input: %s","messagePattern":"failed to get confirmation user input: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app/cli/lib/apply.go","lineNumber":603,"sourceCode":"\t})\n\n\tif apiErr != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to set pending results applied: %s\", apiErr.Msg)\n\t}\n\n\treturn commitSummary, nil\n}\n\nfunc commitApplied(autoCommit bool, commitSummary string, updatedFiles []string, currentPlanState *shared.CurrentPlanState) (err error) {\n\tconfirmed := autoCommit\n\tif !autoCommit {\n\t\tfmt.Println(\"✏️  Plandex can commit these updates with an automatically generated message.\")\n\t\tfmt.Println()\n\t\t// fmt.Println(\"ℹ️  Only the files that Plandex is updating will be included the commit. Any other changes, staged or unstaged, will remain exactly as they are.\")\n\t\t// fmt.Println()\n\t\tconfirmed, err = term.ConfirmYesNo(\"Commit Plandex updates now?\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get confirmation user input: %s\", err)\n\t\t}\n\t}\n\n\tif confirmed {\n\t\t// Commit the changes\n\t\tmsg := currentPlanState.PendingChangesSummaryForApply(commitSummary)\n\t\t// log.Println(\"Committing changes with message:\")\n\t\t// log.Println(msg)\n\t\t// spew.Dump(currentPlanState)\n\t\terr = GitAddAndCommitPaths(fs.ProjectRoot, msg, updatedFiles, true)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to commit changes: %s\", err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/apply.go#L585-L621","documentation":"commitApplied asks the user to confirm committing the applied updates via term.ConfirmYesNo when auto-commit is off. If reading the terminal answer fails (non-interactive stdin, closed pipe, EOF), the CLI wraps the terminal error in this message.","triggerScenarios":"term.ConfirmYesNo(\"Commit Plandex updates now?\") returns an error — stdin is not a TTY or is closed, the user pressed Ctrl-D/Ctrl-C, or the terminal read was interrupted.","commonSituations":"Running plandex apply in CI or scripted pipelines without a TTY; piping stdin from another command; running in a sandboxed environment with no controlling terminal.","solutions":["Use 'plandex apply --yes' (auto-commit) or the equivalent flag to skip the interactive prompt","Run the command in an interactive terminal","Pipe 'yes | ' or echo y into the command as a last resort in scripts","Redirect stderr/stdin properly and ensure the terminal is attached"],"exampleFix":"// before (script)\nplandex apply\n// after (non-interactive)\nplandex apply --yes","handlingStrategy":"try-catch","validationCode":"// detect non-interactive stdin before prompting\nstat, _ := os.Stdin.Stat()\nif (stat.Mode() & os.ModeCharDevice) == 0 {\n  // use auto-commit flag instead of prompting\n}","typeGuard":null,"tryCatchPattern":"confirmed, err := term.ConfirmYesNo(\"Commit Plandex updates now?\")\nif err != nil {\n  // fall back to auto-commit or abort cleanly\n  return fmt.Errorf(\"confirmation failed (non-interactive terminal?): %w\", err)\n}","preventionTips":["Use the auto-commit/--yes flag in CI and scripts","Always run apply from an interactive TTY","Avoid piping stdin when the command prompts","Handle Ctrl-D/Ctrl-C prompts gracefully in shell wrappers"],"tags":["go","cli","terminal","stdin"],"backgroundTag":"non-interactive-terminal","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}