{"record":{"id":"b9601a43bae9bfb8","repo":"hasura/graphql-engine","slug":"error-generating-codegen-for-action-s-w","errorCode":null,"errorMessage":"error generating codegen for action %s: %w","messagePattern":"error generating codegen for action (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/actions_codegen.go","lineNumber":144,"sourceCode":"\tif len(o.actions) == 0 {\n\t\tactionsFileContent, err := actionCfg.GetActionsFileContent()\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"error getting actions file content: %w\", err))\n\t\t}\n\n\t\tfor _, action := range actionsFileContent.Actions {\n\t\t\tcodegenActions = append(codegenActions, action.Name)\n\t\t}\n\t} else {\n\t\tcodegenActions = o.actions\n\t}\n\n\tfor _, actionName := range codegenActions {\n\t\terr = actionCfg.Codegen(actionName, derivePayload)\n\t\tif err != nil {\n\t\t\treturn errors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"error generating codegen for action %s: %w\", actionName, err),\n\t\t\t)\n\t\t}\n\t}\n\n\to.EC.Spinner.Stop()\n\to.EC.Logger.Info(\"Codegen files generated at \" + o.EC.Config.ActionConfig.Codegen.OutputDir)\n\n\treturn nil\n}\n","sourceCodeStart":126,"sourceCodeEnd":154,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/actions_codegen.go#L126-L154","documentation":"Thrown when the CLI's per-action code generation step (actionCfg.Codegen(actionName, derivePayload)) fails while iterating over the actions to generate handler stub code for. Codegen reads the framework template from the cloned codegen-assets repo, renders it, and writes the output directory; failure at any of those steps raises this with the action name included.","triggerScenarios":"Running `hasura actions codegen` when the codegen-assets templates for the configured framework are missing/corrupt, the configured codegen framework in config.yaml is unknown, the output directory is not writable, or the actions.yaml definition for the named action is invalid for templating.","commonSituations":"Config.yaml codegen section pointing to a framework not present in the cloned assets repo (stale clone after upgrading CLI), read-only project directory in CI, or actions.yaml referencing types that no longer exist.","solutions":["Read the wrapped error — it names the underlying cause (template missing, write failed, etc.).","Delete and re-clone the codegen-assets repo (remove the CLI's clone dir and rerun) so templates match your CLI version.","Verify config.yaml's actions.codegen.framework and output_dir are valid and the output dir is writable.","Validate the failing action's definition in actions.yaml (name, handler webhook, types).","Re-run `hasura actions use-codegen` to re-select a supported framework."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"test -d \"$HOME/.hasura/codegen-assets\" && test -w \"$(yq e '.actions.codegen.output_dir' config.yaml)\"","typeGuard":null,"tryCatchPattern":"Catch per-action failures, log the action name from the message, refresh the codegen-assets clone, and re-run codegen for remaining actions.","preventionTips":["Refresh the codegen-assets clone after CLI upgrades.","Keep output directories writable.","Validate actions.yaml before codegen."],"tags":["codegen","templates","hasura-cli","filesystem"],"backgroundTag":"template-rendering-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}