{"record":{"id":"e04cf9f19138bd86","repo":"hasura/graphql-engine","slug":"error-getting-actions-file-content-w","errorCode":null,"errorMessage":"error getting actions file content: %w","messagePattern":"error getting actions file content: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/actions_codegen.go","lineNumber":129,"sourceCode":"\tif o.EC.Config.ActionConfig.Codegen.Framework == \"\" {\n\t\treturn errors.E(\n\t\t\top,\n\t\t\tstderrors.New(`could not find codegen config. For adding codegen config, run:\n\n  hasura actions use-codegen`),\n\t\t)\n\t}\n\n\t// if no actions are passed, perform codegen for all actions\n\to.EC.Spin(\"Generating code...\")\n\n\tvar codegenActions []string\n\n\tactionCfg := actions.New(o.EC, o.EC.MetadataDir)\n\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}","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/actions_codegen.go#L111-L147","documentation":"Thrown when no specific actions are passed to `hasura actions codegen`, so the CLI falls back to reading all actions from the actions file (actions.yaml in the metadata directory) via actionCfg.GetActionsFileContent(), and that read/parse fails. The actions file is missing, unreadable, or invalid YAML.","triggerScenarios":"Running `hasura actions codegen` with no action name arguments when metadata/actions.yaml does not exist, has malformed YAML, lacks the expected `actions:` structure, or the metadata directory permissions deny reading.","commonSituations":"Running codegen before ever creating an action (`hasura actions create`), pointing --metadata-dir at the wrong directory, hand-editing actions.yaml and breaking indentation, or a fresh checkout missing uncommitted metadata files.","solutions":["Confirm actions.yaml exists under your metadata directory and lists at least one action.","Validate the YAML (e.g. `yq . metadata/actions.yaml`) and fix syntax/structure (needs a top-level `actions:` list with `name` fields).","Create an action first with `hasura actions create <name>` so the file is generated correctly.","Check the --metadata-dir flag / HASURA_METADATA_DIR env points at the right folder."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"test -f metadata/actions.yaml && yq e '.actions[0].name' metadata/actions.yaml >/dev/null","typeGuard":null,"tryCatchPattern":"Catch and check the wrapped error for YAML/missing-file causes; regenerate actions.yaml via `hasura actions create` or fix YAML before retrying.","preventionTips":["Run `hasura actions create` before codegen.","Lint actions.yaml in CI.","Commit metadata files to the repo."],"tags":["yaml","metadata","hasura-cli","codegen","file-io"],"backgroundTag":"yaml-parse-error","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}