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
- Use one of the supported values: json or yaml
- Check for typos in the --output-format flag value
- Run `hasura metadata export --help` to confirm the formats supported by your CLI version
- 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
- Whitelist the format flag in scripts (json|yaml only)
- Check --help for supported values after CLI upgrades
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
- writing output failed: %w
- metadata diff doesn't support difftype %s
- metadata diff only works with folder but got file %s
- displaying metadata failed: %w
- error while parsing the endpoint :%w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/dd35088bce561de4.
Report an issue: GitHub.