hasura/graphql-engine · error

error in getting user input: %w

Error message

error in getting user input: %w

What it means

Thrown when the interactive yes/no prompt asking whether to generate framework code (util.GetYesNoPrompt) fails. These prompt helpers fail when there is no interactive TTY on stdin — e.g. when the command runs in a script, pipe, or CI without --with-codegen specified.

Source

Thrown at cli/commands/actions_create.go:140

			return errors.E(
				op,
				stderrors.New(`could not find codegen config. For adding codegen config, run:

  hasura actions use-codegen`),
			)
		}

		return nil
	}

	// if with-codegen flag not present, ask them if they want to codegen
	var confirmation bool
	if !o.withCodegen {
		confirmation, err = util.GetYesNoPrompt(
			"Do you want to generate " + o.EC.Config.ActionConfig.Codegen.Framework + " code for this action and the custom types?",
		)
		if err != nil {
			return errors.E(op, fmt.Errorf("error in getting user input: %w", err))
		}
	}

	if !confirmation {
		infoMsg := fmt.Sprintf(`You skipped codegen. For getting codegen for this action, run:

  hasura actions codegen %s
`, o.name)
		o.EC.Logger.Info(infoMsg)

		return nil
	}

	if err := o.EC.SetupCodegenAssetsRepo(); err != nil {
		o.EC.Logger.Errorf(
			"failed generating code: setting up codegen-assets repo failed (this is required for automatically generating actions code): %v",
			err,
		)

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Pass --with-codegen (or run in a real terminal) so no prompt is needed.
  2. Ensure stdin is a TTY when interactive behavior is desired (e.g. `docker exec -it`, ssh -t).
  3. In scripts, always specify all flags explicitly to avoid prompts entirely.

Example fix

// before (CI, no TTY)
hasura actions create doSomething --derive-from 'query {...}'
// after
hasura actions create doSomething --derive-from 'query {...}' --with-codegen
Defensive patterns

Strategy: validation

Validate before calling

[ -t 0 ] || echo 'stdin is not a TTY: pass --with-codegen explicitly'

Try / catch

Catch prompt errors and re-run with explicit flags (--with-codegen) or allocate a TTY.

Prevention

When it happens

Trigger: Running `hasura actions create` in a non-interactive shell (CI, docker exec without -t, piped stdin) where a codegen framework is configured but the --with-codegen flag was not passed, forcing the CLI to prompt.

Common situations: Automating actions create in CI without flags; running through ssh with no TTY; stdin redirected from /dev/null.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/bfb66c4279c66078. Report an issue: GitHub.