{"record":{"id":"c12654803634117e","repo":"hasura/graphql-engine","slug":"error-in-applying-metadata-w","errorCode":null,"errorMessage":"error in applying metadata: %w","messagePattern":"error in applying metadata: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/actions_create.go","lineNumber":114,"sourceCode":"\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,\n\t\t\t\tstderrors.New(`could not find codegen config. For adding codegen config, run:\n\n  hasura actions use-codegen`),\n\t\t\t)\n\t\t}\n\n\t\treturn nil\n\t}\n","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/actions_create.go#L96-L132","documentation":"After writing the new action to metadata, `hasura actions create` immediately applies metadata to the server by running MetadataApplyOptions.Run(); any failure from that apply (bad metadata, server rejection, connectivity) is wrapped with this message.","triggerScenarios":"The freshly written metadata is rejected by the Hasura engine (invalid type definition, conflicting action name on the server), the server is unreachable mid-run, or the admin secret lacks permission to apply metadata.","commonSituations":"Metadata referencing types not defined in types.yaml, server already has a conflicting action, transient network drop between file write and apply, or running create against a production endpoint with restricted permissions.","solutions":["Inspect the wrapped apply error — it usually contains the Hasura error path (e.g. 'action A: type T not found').","Fix the reported inconsistency in metadata/actions.yaml and types.yaml.","Re-run `hasura metadata apply` once the server-side conflict is resolved.","Verify endpoint/admin-secret and server connectivity at apply time."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"hasura metadata export --endpoint $ENDPOINT --admin-secret $SECRET # proves apply path works","typeGuard":null,"tryCatchPattern":"Catch the apply error; the file changes already succeeded, so fix the reported metadata inconsistency and run `hasura metadata apply` separately.","preventionTips":["Dry-run metadata validity (`hasura metadata export`) in CI.","Keep types.yaml in sync with actions.yaml.","Ensure server permissions for metadata writes."],"tags":["metadata","hasura-cli","graphql-engine"],"backgroundTag":"metadata-apply-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}