hasura/graphql-engine · error

custom type %s is not present in %s

Error message

custom type %s is not present in %s

What it means

Build fails when a custom enum type declared in the old actions metadata (custom_types.Enums) is not present in the generated GraphQL SDL file. The build validates that every custom type in metadata survives into the SDL produced by the CLI extension converter.

Source

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

	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 {
			return nil, errors.E(
				op,
				errors.KindBadInput,
				a.error(
					fmt.Errorf(
						"custom type %s is not present in %s",
						customType.Name,
						graphqlFileName,
					),
				),
			)
		}
	}

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

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

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Re-add the missing enum definition to graphql.actions.graphql with the exact name from the error message
  2. Regenerate the SDL from metadata so all custom types are emitted
  3. Delete the enum from metadata custom_types if it is truly obsolete

Example fix

# before: enum missing from graphql.actions.graphql

# after:
enum MyStatus {
  ACTIVE
  INACTIVE
}
Defensive patterns

Strategy: validation

Validate before calling

// Check each metadata enum name appears in the SDL before Build
func enumsPresent(enums []string, sdl string) bool {
  for _, e := range enums {
    if !strings.Contains(sdl, "enum "+e) { return false }
  }
  return true
}

Prevention

When it happens

Trigger: Calling Build() after an enum listed under custom_types in metadata was removed or renamed in graphql.actions.graphql, or when the enum was never carried over during SDL generation.

Common situations: Renaming an enum in the .graphql file without updating metadata; deleting unused-looking enums from SDL that metadata still references; version drift between metadata format and generated SDL.

Related errors


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