hasura/graphql-engine · error

error in converting sdl to metadata: %w

Error message

error in converting sdl to metadata: %w

What it means

Thrown by Actions.Create when the SDL collected from the editor must be converted to action metadata via the cli-extension server's ConvertSDLToMetadata endpoint and that call fails. The extension error is wrapped in the message.

Source

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

	data, err := editor.CaptureInputFromEditor(
		editor.GetPreferredEditorFromEnvironment,
		graphqlFileContent,
		"graphql",
	)
	if err != nil {
		return errors.E(op, fmt.Errorf("error in getting input from editor: %w", err))
	}

	sdlFromReq := types.SDLFromRequest{
		SDL: types.SDLPayload{
			Complete: string(data),
		},
	}

	sdlFromResp, err := a.cliExtensionConfig.ConvertSDLToMetadata(sdlFromReq)
	if err != nil {
		return errors.E(op, fmt.Errorf("error in converting sdl to metadata: %w", err))
	}

	currentActionNames := make([]string, 0)
	for actionIndex, action := range sdlFromResp.Actions {
		if slices.Contains(currentActionNames, action.Name) {
			return errors.E(
				op,
				fmt.Errorf("action %s already exists in %s", action.Name, graphqlFileName),
			)
		}

		currentActionNames = append(currentActionNames, action.Name)
		for oldActionIndex, oldActionObj := range oldAction.Actions {
			if action.Name == oldActionObj.Name {
				sdlFromResp.Actions[actionIndex].Permissions = oldAction.Actions[oldActionIndex].Permissions
				sdlFromResp.Actions[actionIndex].Comment = oldAction.Actions[oldActionIndex].Comment
				sdlFromResp.Actions[actionIndex].Definition.Timeout = oldAction.Actions[oldActionIndex].Definition.Timeout
				sdlFromResp.Actions[actionIndex].Definition.Kind = oldAction.Actions[oldActionIndex].Definition.Kind

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Check the wrapped error — extension endpoint errors usually name the cause (process vs parse)
  2. Reinstall/upgrade the CLI so a matching cli-extension is fetched; clear the extension cache
  3. Fix the SDL written in the editor: valid action types with handler and output type definitions
  4. Verify the platform is supported for the bundled cli-extension binary
Defensive patterns

Strategy: retry

Validate before calling

// Sanity-check the SDL before submission: must parse as GraphQL and define the action type
if !graphqlValid(mySDL) || !strings.Contains(mySDL, "handler:") {
	// fix the SDL before invoking Create
}

Try / catch

if err := actions.Create(...); err != nil {
	if strings.Contains(err.Error(), "converting sdl to metadata") {
		// inspect wrapped cause: fix SDL syntax, or repair/reinstall cli-extension, then retry
	}
	return err
}

Prevention

When it happens

Trigger: After the editor closes, Create posts the SDL to the cli-extension; failure occurs when the extension process is missing/crashed, its HTTP endpoint is unreachable, or it rejects the SDL payload (unsupported GraphQL syntax for action definitions).

Common situations: cli-extension binary not downloaded, corrupted, or incompatible with the host OS/arch; version skew between CLI and extension; or hand-written GraphQL in the editor that isn't valid action SDL (missing handler/output types).

Related errors


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