hasura/graphql-engine · error
error in creating action: %w
Error message
error in creating action: %w
What it means
Thrown when `hasura actions create` fails in actionCfg.Create(name, introSchema, deriveFrom), which writes the new action definition and custom types into the metadata files (actions.yaml, types.yaml) and derives types from the operation when --derive-from is used.
Source
Thrown at cli/commands/actions_create.go:105
o.deriveFrom = strings.TrimSpace(o.deriveFrom)
o.EC.Spin("Deriving a Hasura operation...")
introSchema, err = o.EC.APIClient.V1Graphql.GetIntrospectionSchema()
if err != nil {
return errors.E(op, fmt.Errorf("error in fetching introspection schema: %w", err))
}
o.EC.Spinner.Stop()
}
// create new action
o.EC.Spin("Creating the action...")
actionCfg := actions.New(o.EC, o.EC.MetadataDir)
o.EC.Spinner.Stop()
err = actionCfg.Create(o.name, introSchema, o.deriveFrom)
if err != nil {
return errors.E(op, fmt.Errorf("error in creating action: %w", err))
}
opts := &MetadataApplyOptions{
EC: o.EC,
}
err = opts.Run()
if err != nil {
return errors.E(op, fmt.Errorf("error in applying metadata: %w", err))
}
o.EC.Logger.WithField("name", o.name).Infoln("action created")
// if codegen config not present, skip codegen
if o.EC.Config.ActionConfig.Codegen.Framework == "" {
if o.withCodegen {
return errors.E(
op,View on GitHub (pinned to 724551b9ae)
Solutions
- Read the wrapped error for the precise cause (file write vs type derivation).
- Ensure metadata/actions.yaml and types.yaml are valid YAML and writable.
- If deriving, confirm the --derive-from operation is valid against the current schema and uses named fields the engine can resolve.
- If the action name already exists, pick a different name or remove the old entry first.
Defensive patterns
Strategy: validation
Validate before calling
yq e '.actions[].name' metadata/actions.yaml | grep -qx 'my-action' || echo 'name free'; test -w metadata/actions.yaml
Try / catch
Catch and read the wrapped error: fix metadata files or pick a new action name, then re-run `hasura actions create`.
Prevention
- Keep actions.yaml/types.yaml valid and committed.
- Check for name collisions before create.
- Run in a writable checkout.
When it happens
Trigger: Creating an action when the metadata directory/actions.yaml is malformed or not writable, when deriving types fails because the operation references types not present in the introspection schema, or when an action with the same name already exists per the underlying check.
Common situations: Hand-edited metadata files with inconsistent custom types, running create twice with the same name, derive-from query containing anonymous fragments or unsupported constructs, or read-only filesystem in CI.
Related errors
- error getting actions file content: %w
- cue extraction error: %w
- cannot build %s from project: %w
- parsing yaml metadata to json: %w
- parsing metadata to yaml: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/9779a12321d4ccb4.
Report an issue: GitHub.