hasura/graphql-engine · error

action %s is not present in %s

Error message

action %s is not present in %s

What it means

Thrown by the actions metadata Build step when an action handler defined in the actions metadata cannot be found in the generated GraphQL SDL file (graphql.actions.graphql). The build cross-checks every action name in metadata against the SDL produced by the CLI extension; a missing entry means metadata and SDL are out of sync.

Source

Thrown at cli/internal/metadataobject/actions/actions.go:410

				sdlFromResp.Actions[newActionIndex].Permissions = oldAction.Actions[actionIndex].Permissions
				sdlFromResp.Actions[newActionIndex].Comment = oldAction.Actions[actionIndex].Comment
				sdlFromResp.Actions[newActionIndex].Definition.Timeout = oldAction.Actions[actionIndex].Definition.Timeout
				sdlFromResp.Actions[newActionIndex].Definition.Kind = oldAction.Actions[actionIndex].Definition.Kind
				sdlFromResp.Actions[newActionIndex].Definition.Handler = oldAction.Actions[actionIndex].Definition.Handler
				sdlFromResp.Actions[newActionIndex].Definition.ForwardClientHeaders = oldAction.Actions[actionIndex].Definition.ForwardClientHeaders
				sdlFromResp.Actions[newActionIndex].Definition.Headers = oldAction.Actions[actionIndex].Definition.Headers
				sdlFromResp.Actions[newActionIndex].Definition.RequestTransform = oldAction.Actions[actionIndex].Definition.RequestTransform
				sdlFromResp.Actions[newActionIndex].Definition.ResponseTransform = oldAction.Actions[actionIndex].Definition.ResponseTransform

				break
			}
		}

		if !isFound {
			return nil, errors.E(
				op,
				errors.KindBadInput,
				a.error(fmt.Errorf("action %s is not present in %s", action.Name, graphqlFileName)),
			)
		}
	}

	for customTypeIndex, customType := range oldAction.CustomTypes.Enums {
		var isFound bool

		for newTypeObjIndex, newTypeObj := range sdlFromResp.Types.Enums {
			if customType.Name == newTypeObj.Name {
				isFound = true
				sdlFromResp.Types.Enums[newTypeObjIndex].Description = oldAction.CustomTypes.Enums[customTypeIndex].Description
				sdlFromResp.Types.Enums[newTypeObjIndex].Relationships = oldAction.CustomTypes.Enums[customTypeIndex].Relationships

				break
			}
		}

		if !isFound {

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Restore or re-add the missing action definition to graphql.actions.graphql so it matches the metadata action name
  2. Regenerate the SDL from metadata via ConvertMetadataToSDL / hasura actions codegen instead of editing by hand
  3. Remove the stale action entry from actions metadata if it was intentionally deleted

Example fix

# before: actions.yaml has
handlers:
  myAction: ...
# but graphql.actions.graphql lost `type Mutation { myAction(...): ... }`

# after: restore in graphql.actions.graphql
type Mutation {
  myAction(arg: String!): String!
}
Defensive patterns

Strategy: validation

Validate before calling

// Before Build: confirm every action in metadata exists in the SDL file
import (
  "os"
  "strings"
)

func actionsPresentInSDL(metadataActions []string, sdlPath string) bool {
  b, err := os.ReadFile(sdlPath)
  if err != nil { return false }
  sdl := string(b)
  for _, a := range metadataActions {
    if !strings.Contains(sdl, a+"(") { return false }
  }
  return true
}

Prevention

When it happens

Trigger: Calling actions Build() when an action exists in actions.yaml/metadata but its corresponding definition was removed or renamed in the graphql.actions.graphql file, or when SDL-to-metadata conversion dropped it.

Common situations: Hand-editing the GraphQL SDL file and deleting/renaming a type or action that metadata still references; partial regeneration of the SDL file; merging metadata branches that updated actions.yaml but not the .graphql file.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/31e4d0262fb61f54. Report an issue: GitHub.