{"record":{"id":"61d44cc6e3ec1adc","repo":"hasura/graphql-engine","slug":"error-getting-user-input-w","errorCode":null,"errorMessage":"error getting user input: %w","messagePattern":"error getting user input: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/migrate_delete.go","lineNumber":64,"sourceCode":"\t\t\t\t\tstderrors.New(\"at least one flag [--all , --version] should be set\"),\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif cmd.Flags().Changed(\"all\") && cmd.Flags().Changed(\"version\") {\n\t\t\t\treturn errors.E(op, stderrors.New(\"only one of [--all , --version] should be set\"))\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\top := genOpName(cmd, \"RunE\")\n\t\t\t// exit if user inputs n for clearing migrations\n\t\t\tif cmd.Flags().Changed(\"all\") && !opts.Force && opts.EC.IsTerminal {\n\t\t\t\tconfirmation, err := util.GetYesNoPrompt(\n\t\t\t\t\t\"clear all migrations of database and it's history on the server?\",\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.E(op, fmt.Errorf(\"error getting user input: %w\", err))\n\t\t\t\t}\n\n\t\t\t\tif !confirmation {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ec.AllDatabases && !opts.Force {\n\t\t\t\tconfirmation, err := util.GetYesNoPrompt(\n\t\t\t\t\t\"clear all mentioned migrations of all databases and it's history on the server?\",\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.E(op, fmt.Errorf(\"error getting user input: %w\", err))\n\t\t\t\t}\n\n\t\t\t\tif !confirmation {\n\t\t\t\t\treturn nil\n\t\t\t\t}","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/migrate_delete.go#L46-L82","documentation":"During `hasura migrate delete` with --all and without --force in a terminal, the CLI asks for a yes/no confirmation via util.GetYesNoPrompt. This wraps failures reading that user input (stdin closed, invalid input loop, terminal error).","triggerScenarios":"Running migrate delete --all in an environment where stdin is closed or non-interactive (piped CI job) but the CLI still detected a terminal, or EOF on the prompt.","commonSituations":"CI jobs forgetting --force; piping input that ends before answering; running under a broken TTY wrapper.","solutions":["Use --force in non-interactive scripts: hasura migrate delete --all --force","Pipe an explicit answer: echo y | hasura migrate delete --all (where supported)","Avoid closing stdin when running interactively"],"exampleFix":"# before\nhasura migrate delete --all   # stdin is /dev/null in CI\n# after\nhasura migrate delete --all --force","handlingStrategy":"validation","validationCode":"if [ ! -t 0 ] && [ \"$FORCE\" != \"1\" ]; then FORCE_FLAG=--force; else FORCE_FLAG=; fi","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"error getting user input\") { /* rerun with --force */ }","preventionTips":["Always pass --force in CI/non-interactive migrate delete scripts","Provide stdin or avoid piped execution of destructive prompts"],"tags":["migrate-delete","user-input","non-interactive"],"backgroundTag":"stdin-prompt-read-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}