hasura/graphql-engine · error

error in fetching codegen frameworks: %w

Error message

error in fetching codegen frameworks: %w

What it means

Thrown when getCodegenFrameworks() fails while `hasura actions use-codegen` tries to list available codegen frameworks. That helper reads the frameworks manifest from the locally cloned codegen-assets repo (guaranteed present by PreRunE), so failure means the manifest file is missing or unparseable.

Source

Thrown at cli/commands/actions_use_codegen.go:123

func (o *actionsUseCodegenOptions) run() error {
	var op errors.Op = "commands.actionsUseCodegenOptions.run"

	o.EC.Spin("Ensuring codegen-assets repo is updated...")
	defer o.EC.Spinner.Stop()
	// ensure the actions-codegen repo is updated
	err := o.EC.CodegenAssetsRepo.EnsureUpdated()
	if err != nil {
		o.EC.Logger.Warnf("unable to update codegen-assets repo, got %v", err)
	}

	newCodegenExecutionConfig := o.EC.Config.ActionConfig.Codegen
	newCodegenExecutionConfig.Framework = ""

	o.EC.Spin("Fetching frameworks...")

	allFrameworks, err := getCodegenFrameworks()
	if err != nil {
		return errors.E(op, fmt.Errorf("error in fetching codegen frameworks: %w", err))
	}

	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 {

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Delete the local codegen-assets clone directory so the next run pulls a fresh, version-matched copy.
  2. Upgrade (or pin) the Hasura CLI to the version whose assets layout you cloned.
  3. Re-run `hasura actions use-codegen` after the fresh clone.
Defensive patterns

Strategy: retry

Validate before calling

test -d "$HOME/.hasura/codegen-assets" && find "$HOME/.hasura/codegen-assets" -name '*framework*' | grep -q .

Try / catch

Catch, delete the codegen-assets clone so PreRunE re-pulls a fresh manifest, and retry.

Prevention

When it happens

Trigger: Running use-codegen when the cloned codegen-assets repo lacks the expected frameworks definition file — typically a stale/partial clone, a CLI version expecting a manifest layout the cloned repo doesn't have, or files deleted after PreRunE ran.

Common situations: Upgraded CLI but old clone cached in home dir; clone interrupted mid-checkout; antivirus/permissions removing files from the clone.

Related errors


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