hasura/graphql-engine · error

data error

Error message

data error: %s

What it means

NewHasuraError's default branch: the response data is an error of an unrecognized shape (neither a parseable HasuraError JSON object nor a handled case), so the raw data is surfaced verbatim.

Solutions

  1. Inspect the raw data in the message to identify the producer
  2. Align CLI and server versions
  3. Check for proxies/firewalls mangling responses
Defensive patterns

Strategy: try-catch

Try / catch

if err != nil {
    log.Printf("raw API error data: %v", err)
    // parse raw payload from message to identify origin
}

Prevention

When it happens

Trigger: An API response error payload that doesn't match any known structure, e.g. a JSON string error, empty body with error status, or a new server error format.

Common situations: Server/CLI version skew where the server emits a newer error format, or intermediate proxies altering responses.

Related errors


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

Appendix: source

Thrown at cli/migrate/database/hasuradb/types.go:195

// NewHasuraError - returns error based on data and isCmd.
func NewHasuraError(data []byte, isCmd bool) error {
	var op errors.Op = "hasuradb.NewHasuraError"

	switch isCmd {
	case true:
		var herror HasuraError

		err := json.Unmarshal(data, &herror)
		if err != nil {
			return errors.E(
				op,
				fmt.Errorf("failed parsing json: %w; response from API: %s", err, string(data)),
			)
		}

		return herror
	default:
		return errors.E(op, fmt.Errorf("data error: %s", string(data)))
	}
}

View on GitHub (pinned to 724551b9ae)