hasura/graphql-engine · error
error in getting output directory input: %w
Error message
error in getting output directory input: %w
What it means
Thrown when util.GetFSPathPrompt fails while interactively asking where to place codegen files (shown because --output-dir was omitted). Same TTY-dependent prompt failure family: it cannot read an answer from non-interactive stdin.
Source
Thrown at cli/commands/actions_use_codegen.go:232
destinationDir,
)
if err != nil {
return errors.E(op, fmt.Errorf("error in copying starter kit: %w", err))
}
o.EC.Logger.Info("Starter kit cloned at " + destinationDir)
}
o.EC.Spinner.Stop()
// if output directory is not provided, make them enter it
if o.outputDir == "" {
outputDir, err := util.GetFSPathPrompt(
"Where do you want to place the codegen files?",
o.EC.Config.ActionConfig.Codegen.OutputDir,
)
if err != nil {
return errors.E(op, fmt.Errorf("error in getting output directory input: %w", err))
}
newCodegenExecutionConfig.OutputDir = outputDir
} else {
newCodegenExecutionConfig.OutputDir = o.outputDir
}
newConfig := o.EC.Config
newConfig.ActionConfig.Codegen = newCodegenExecutionConfig
err = o.EC.WriteConfig(newConfig)
if err != nil {
return errors.E(op, fmt.Errorf("error in writing config: %w", err))
}
o.EC.Spinner.Stop()
o.EC.Logger.Info("Codegen configuration updated in config.yaml")
View on GitHub (pinned to 724551b9ae)
Solutions
- Pass --output-dir <path> explicitly in all scripted runs.
- Run with an interactive TTY when you want to be prompted.
Example fix
// before (CI) hasura actions use-codegen --framework nodejs-express --with-starter-kit // after hasura actions use-codegen --framework nodejs-express --with-starter-kit --output-dir src/generated
Defensive patterns
Strategy: validation
Validate before calling
[ -t 0 ] || echo 'pass --output-dir explicitly in non-interactive shells'
Try / catch
Catch prompt errors and re-run with an explicit --output-dir.
Prevention
- Always pass --output-dir in scripts.
- Allocate a TTY when prompting is desired.
When it happens
Trigger: Running `hasura actions use-codegen` without --output-dir in a non-interactive environment (CI, piped stdin, no TTY).
Common situations: Scripted/automated CLI runs missing the output-dir flag; docker/ssh sessions without terminal allocation.
Related errors
- error in getting user input: %w
- error in selecting framework: %w
- error in getting input from user: %w
- error in selecting a database to use: %w
- unable to get available databases: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/38388399305c1693.
Report an issue: GitHub.