hasura/graphql-engine · error

output format '%v' is not supported. supported formats: %v,

Error message

output format '%v' is not supported. supported formats: %v, %v

What it means

writeByOutputFormat only supports JSON and YAML output formats; any other value passed as the format hits the default branch and returns this error listing the valid options. It is a pure input-validation error, thrown before any metadata is fetched or converted.

Source

Thrown at cli/commands/metadata.go:128

		_, err = io.Copy(w, out)
		if err != nil {
			return errors.E(op, fmt.Errorf("writing output failed: %w", err))
		}
	case rawOutputFormatYAML:
		o, err := metadatautil.JSONToYAML(b)
		if err != nil {
			return errors.E(op, err)
		}

		_, err = io.Copy(w, bytes.NewReader(o))
		if err != nil {
			return errors.E(op, fmt.Errorf("writing output failed: %w", err))
		}
	default:
		return errors.E(
			op,
			fmt.Errorf(
				"output format '%v' is not supported. supported formats: %v, %v",
				format,
				rawOutputFormatJSON,
				rawOutputFormatYAML,
			),
		)
	}

	return nil
}

func isJSON(str []byte) bool {
	var js json.RawMessage

	return json.Unmarshal(str, &js) == nil
}

func isYAML(str []byte) bool {

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Use one of the supported values: json or yaml
  2. Check for typos in the --output-format flag value
  3. Run `hasura metadata export --help` to confirm the formats supported by your CLI version
  4. If you need another format, export as JSON/YAML and convert with jq/yq afterwards

Example fix

# before
hasura metadata export --output-format xml
# after
hasura metadata export --output-format json
Defensive patterns

Strategy: validation

Validate before calling

// Go: validate the format before calling
var validFormats = map[rawOutputFormat]bool{rawOutputFormatJSON: true, rawOutputFormatYAML: true}
if !validFormats[format] {
  return fmt.Errorf("unsupported output format %q; use json or yaml", format)
}

Type guard

// Go
func isSupportedOutputFormat(f rawOutputFormat) bool {
  return f == rawOutputFormatJSON || f == rawOutputFormatYAML
}

Prevention

When it happens

Trigger: Passing an unsupported --output-format flag value to a metadata command (e.g. `hasura metadata export --output-format xml` or --output-format toml), or programmatically calling writeByOutputFormat with a rawOutputFormat constant other than rawOutputFormatJSON/rawOutputFormatYAML.

Common situations: Typos in the format flag, scripts written for a newer/older CLI version with different supported formats, copy-pasting commands from docs for a different tool, or custom code constructing rawOutputFormat values from user input without validation.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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