hasura/graphql-engine · error
error in getting codegen for action %s: %w
Error message
error in getting codegen for action %s: %w
What it means
Codegen called the actions codegen extension (GetActionsCodegen) and the extension itself returned an error — the CLI is only surfacing it with the action name. Root causes live in the extension: unsupported language/plugin, malformed SDL payload, or a crashed/missing plugin binary.
Source
Thrown at cli/internal/metadataobject/actions/actions.go:283
}
data := types.ActionsCodegenRequest{
ActionName: name,
SDL: types.SDLPayload{
Complete: graphqlFileContent,
},
CodegenConfig: a.ActionConfig.Codegen,
Derive: derivePld,
}
if a.ActionConfig.Codegen.URI == "" {
data.CodegenConfig.URI = a.getActionsCodegenURI(data.CodegenConfig.Framework)
}
resp, err := a.cliExtensionConfig.GetActionsCodegen(data)
if err != nil {
return errors.E(
op,
fmt.Errorf("error in getting codegen for action %s: %w", data.ActionName, err),
)
}
for _, file := range resp.Files {
err = os.WriteFile(
filepath.Join(a.ActionConfig.Codegen.OutputDir, file.Name),
[]byte(file.Content),
0o644,
)
if err != nil {
return errors.E(op, fmt.Errorf("error in writing codegen file: %w", err))
}
}
return nil
}
func (a *ActionConfig) Validate() error {View on GitHub (pinned to 724551b9ae)
Solutions
- Read the wrapped error from the extension — it names the actual failure (unsupported framework, SDL parse error)
- Upgrade the hasura CLI and its bundled actions codegen extension to the latest version and retry
- Simplify the action signature (remove custom scalars/nested inputs) and retry codegen
- Try a different --derive-from option supported by your extension version
Defensive patterns
Strategy: retry
Try / catch
if err := cfg.Codegen(name, derivePld); err != nil {
if strings.Contains(err.Error(), "error in getting codegen for action") {
// wrapped error is from the extension: surface it, upgrade extension, retry once
log.Printf("codegen extension failed: %v", err)
}
} Prevention
- Keep the actions codegen extension updated with the CLI
- Use --derive-from options documented for your CLI version
- Keep action SDL free of exotic custom scalars when codegenning
When it happens
Trigger: Running `hasura actions codegen <action>` with a derive payload whose language/framework the installed codegen extension does not support, or when the extension process fails on the submitted SDL.
Common situations: Using --derive-from typescript or a specific framework with an outdated actions codegen extension; upgrading the CLI without upgrading extensions; SDL containing custom scalars the codegen plugin can't handle.
Related errors
- error in marshalling common: %w
- error in writing codegen file: %w
- pulling latest actions codegen files from internet failed: %
- error getting actions file content: %w
- error generating codegen for action %s: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/46ebae4877d497cc.
Report an issue: GitHub.