hasura/graphql-engine · error
prompt exited: %w
Error message
prompt exited: %w
What it means
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).
Source
Thrown at cli/commands/init.go:158
}
type InitOptions struct {
EC *cli.ExecutionContext
Version cli.ConfigVersion
Endpoint string
AdminSecret string
InitDir string
GetMetadataMigrations bool
}
func (o *InitOptions) InitRun() error {
var op errors.Op = "commands.InitOptions.InitRun"
// prompt for init directory if it's not set already
if o.InitDir == "" {
r, err := util.GetInputPromptWithDefault("Name of project directory ?", defaultDirectory)
if err != nil {
return errors.E(op, fmt.Errorf("prompt exited: %w", err))
}
if strings.TrimSpace(r) != "" {
o.InitDir = r
} else {
o.InitDir = defaultDirectory
}
}
if o.Endpoint != "" && !o.GetMetadataMigrations && o.EC.IsTerminal {
r, err := util.GetYesNoPrompt(
fmt.Sprintf("Initialize project with metadata & migrations from %s ?", o.Endpoint),
)
if err != nil {
return errors.E(op, fmt.Errorf("prompt exited: %w", err))
}
o.GetMetadataMigrations = rView on GitHub (pinned to 724551b9ae)
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
Example fix
// before hasura init // after hasura init myproject
Defensive patterns
Strategy: validation
Validate before calling
if fi, err := os.Stdin.Stat(); err == nil && (fi.Mode()&os.ModeCharDevice) == 0 {
// non-interactive: require explicit directory argument
if len(os.Args) < 2 { log.Fatal("pass project name: hasura init <name>") }
} Prevention
- Always pass the project name flag in scripts
- Never assume interactive prompts in CI
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- error getting current working directory: %w
- can't initialise hasura project in filesystem root: %w
- directory '%s' already exists
- error creating setup directories: %w
- error validating endpoint URL: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/616e3beae6428126.
Report an issue: GitHub.