hasura/graphql-engine · error

error in selecting framework: %w

Error message

error in selecting framework: %w

What it means

Thrown when util.GetSelectPrompt fails while displaying the interactive list of codegen frameworks (shown because --framework was not passed). Like other prompt helpers, it fails when stdin is not an interactive TTY or the prompt library errors.

Source

Thrown at cli/commands/actions_use_codegen.go:142

	}

	o.EC.Spinner.Stop()

	if o.framework == "" {
		// if framework flag is not provided, display a list and allow them to choose
		var frameworkList []string
		for _, f := range allFrameworks {
			frameworkList = append(frameworkList, f.Name)
		}

		sort.Strings(frameworkList)

		newCodegenExecutionConfig.Framework, err = util.GetSelectPrompt(
			"Choose a codegen framework to use",
			frameworkList,
		)
		if err != nil {
			return errors.E(op, fmt.Errorf("error in selecting framework: %w", err))
		}
	} else {
		for _, f := range allFrameworks {
			if o.framework == f.Name {
				newCodegenExecutionConfig.Framework = o.framework
			}
		}

		if newCodegenExecutionConfig.Framework == "" {
			return errors.E(op, fmt.Errorf("framework %s is not found", o.framework))
		}
	}

	hasStarterKit := false

	for _, f := range allFrameworks {
		if f.Name == newCodegenExecutionConfig.Framework && f.HasStarterKit {
			hasStarterKit = true

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Pass --framework <name> explicitly so no selection prompt is needed.
  2. Run in a real terminal / with a TTY (`docker exec -it`, `ssh -t`) when interactive use is intended.

Example fix

// before (CI)
hasura actions use-codegen
// after
hasura actions use-codegen --framework nodejs-express --output-dir src/generated
Defensive patterns

Strategy: validation

Validate before calling

[ -t 0 ] || echo 'pass --framework explicitly in non-interactive shells'

Try / catch

Catch prompt errors and re-run with an explicit --framework value.

Prevention

When it happens

Trigger: Running `hasura actions use-codegen` without --framework in a non-interactive context (CI job, piped stdin, docker without -t).

Common situations: Scripted setup of codegen config in CI; ssh without TTY; stdin from /dev/null.

Related errors


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