{"record":{"id":"616e3beae6428126","repo":"hasura/graphql-engine","slug":"prompt-exited-w","errorCode":null,"errorMessage":"prompt exited: %w","messagePattern":"prompt exited: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/init.go","lineNumber":158,"sourceCode":"}\n\ntype InitOptions struct {\n\tEC *cli.ExecutionContext\n\n\tVersion               cli.ConfigVersion\n\tEndpoint              string\n\tAdminSecret           string\n\tInitDir               string\n\tGetMetadataMigrations bool\n}\n\nfunc (o *InitOptions) InitRun() error {\n\tvar op errors.Op = \"commands.InitOptions.InitRun\"\n\t// prompt for init directory if it's not set already\n\tif o.InitDir == \"\" {\n\t\tr, err := util.GetInputPromptWithDefault(\"Name of project directory ?\", defaultDirectory)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"prompt exited: %w\", err))\n\t\t}\n\n\t\tif strings.TrimSpace(r) != \"\" {\n\t\t\to.InitDir = r\n\t\t} else {\n\t\t\to.InitDir = defaultDirectory\n\t\t}\n\t}\n\n\tif o.Endpoint != \"\" && !o.GetMetadataMigrations && o.EC.IsTerminal {\n\t\tr, err := util.GetYesNoPrompt(\n\t\t\tfmt.Sprintf(\"Initialize project with metadata & migrations from %s ?\", o.Endpoint),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"prompt exited: %w\", err))\n\t\t}\n\n\t\to.GetMetadataMigrations = r","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/init.go#L140-L176","documentation":"Interactive init prompt failure: `hasura init` asks for the project directory name via util.GetInputPromptWithDefault when --name is not given, and this error is thrown when that prompt fails (EOF, non-tty stdin, or terminal error).","triggerScenarios":"Running `hasura init` without a directory argument in a non-interactive context (piped/closed stdin, CI) so the input prompt returns an error instead of a value.","commonSituations":"CI pipelines or scripts invoking `hasura init` without flags; stdin redirected from /dev/null; running the CLI through a wrapper that doesn't allocate a TTY.","solutions":["Pass the directory explicitly: `hasura init myproject` (or --name myproject)","Run in an interactive terminal when prompts are expected","Pipe a value in (echo myproject | hasura init) if automation requires it"],"exampleFix":"// before\nhasura init\n// after\nhasura init myproject","handlingStrategy":"validation","validationCode":"if fi, err := os.Stdin.Stat(); err == nil && (fi.Mode()&os.ModeCharDevice) == 0 {\n    // non-interactive: require explicit directory argument\n    if len(os.Args) < 2 { log.Fatal(\"pass project name: hasura init <name>\") }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass the project name flag in scripts","Never assume interactive prompts in CI"],"tags":["hasura","cli","init","prompt","non-interactive"],"backgroundTag":"interactive-prompt-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}