{"record":{"id":"dd35088bce561de4","repo":"hasura/graphql-engine","slug":"output-format-v-is-not-supported-supported-for","errorCode":null,"errorMessage":"output format '%v' is not supported. supported formats: %v, %v","messagePattern":"output format '(.+?)' is not supported\\. supported formats: (.+?), (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/metadata.go","lineNumber":128,"sourceCode":"\n\t\t_, err = io.Copy(w, out)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"writing output failed: %w\", err))\n\t\t}\n\tcase rawOutputFormatYAML:\n\t\to, err := metadatautil.JSONToYAML(b)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, err)\n\t\t}\n\n\t\t_, err = io.Copy(w, bytes.NewReader(o))\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"writing output failed: %w\", err))\n\t\t}\n\tdefault:\n\t\treturn errors.E(\n\t\t\top,\n\t\t\tfmt.Errorf(\n\t\t\t\t\"output format '%v' is not supported. supported formats: %v, %v\",\n\t\t\t\tformat,\n\t\t\t\trawOutputFormatJSON,\n\t\t\t\trawOutputFormatYAML,\n\t\t\t),\n\t\t)\n\t}\n\n\treturn nil\n}\n\nfunc isJSON(str []byte) bool {\n\tvar js json.RawMessage\n\n\treturn json.Unmarshal(str, &js) == nil\n}\n\nfunc isYAML(str []byte) bool {","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/metadata.go#L110-L146","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nhasura metadata export --output-format xml\n# after\nhasura metadata export --output-format json","handlingStrategy":"validation","validationCode":"// Go: validate the format before calling\nvar validFormats = map[rawOutputFormat]bool{rawOutputFormatJSON: true, rawOutputFormatYAML: true}\nif !validFormats[format] {\n  return fmt.Errorf(\"unsupported output format %q; use json or yaml\", format)\n}","typeGuard":"// Go\nfunc isSupportedOutputFormat(f rawOutputFormat) bool {\n  return f == rawOutputFormatJSON || f == rawOutputFormatYAML\n}","tryCatchPattern":null,"preventionTips":["Whitelist the format flag in scripts (json|yaml only)","Check --help for supported values after CLI upgrades"],"tags":["validation","output-format","cli","metadata-export"],"backgroundTag":"invalid-argument-value","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}