{"record":{"id":"9779a12321d4ccb4","repo":"hasura/graphql-engine","slug":"error-in-creating-action-w","errorCode":null,"errorMessage":"error in creating action: %w","messagePattern":"error in creating action: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/actions_create.go","lineNumber":105,"sourceCode":"\t\to.deriveFrom = strings.TrimSpace(o.deriveFrom)\n\t\to.EC.Spin(\"Deriving a Hasura operation...\")\n\n\t\tintroSchema, err = o.EC.APIClient.V1Graphql.GetIntrospectionSchema()\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"error in fetching introspection schema: %w\", err))\n\t\t}\n\n\t\to.EC.Spinner.Stop()\n\t}\n\n\t// create new action\n\to.EC.Spin(\"Creating the action...\")\n\tactionCfg := actions.New(o.EC, o.EC.MetadataDir)\n\to.EC.Spinner.Stop()\n\n\terr = actionCfg.Create(o.name, introSchema, o.deriveFrom)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"error in creating action: %w\", err))\n\t}\n\n\topts := &MetadataApplyOptions{\n\t\tEC: o.EC,\n\t}\n\n\terr = opts.Run()\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"error in applying metadata: %w\", err))\n\t}\n\n\to.EC.Logger.WithField(\"name\", o.name).Infoln(\"action created\")\n\n\t// if codegen config not present, skip codegen\n\tif o.EC.Config.ActionConfig.Codegen.Framework == \"\" {\n\t\tif o.withCodegen {\n\t\t\treturn errors.E(\n\t\t\t\top,","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/actions_create.go#L87-L123","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"yq e '.actions[].name' metadata/actions.yaml | grep -qx 'my-action' || echo 'name free'; test -w metadata/actions.yaml","typeGuard":null,"tryCatchPattern":"Catch and read the wrapped error: fix metadata files or pick a new action name, then re-run `hasura actions create`.","preventionTips":["Keep actions.yaml/types.yaml valid and committed.","Check for name collisions before create.","Run in a writable checkout."],"tags":["metadata","yaml","hasura-cli","codegen"],"backgroundTag":"metadata-write-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}