{"record":{"id":"ae036cb5486136bd","repo":"hasura/graphql-engine","slug":"metadata-diff-doesn-t-support-difftype-s","errorCode":null,"errorMessage":"metadata diff doesn't support difftype %s","messagePattern":"metadata diff doesn't support difftype (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/metadata_diff.go","lineNumber":75,"sourceCode":"\t\tPreRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\top := genOpName(cmd, \"PreRunE\")\n\n\t\t\tif len(opts.DiffType) > 0 {\n\t\t\t\toptsDiffType := DiffType(opts.DiffType)\n\n\t\t\t\tdiffTypes := []DiffType{\n\t\t\t\t\tDifftypeJSON,\n\t\t\t\t\tDifftypeYAML,\n\t\t\t\t\tDifftypeUnifiedJSON,\n\t\t\t\t\tDifftypeUnifiedYAML,\n\t\t\t\t}\n\t\t\t\tif slices.Contains(diffTypes, optsDiffType) {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\n\t\t\t\treturn errors.E(\n\t\t\t\t\top,\n\t\t\t\t\tfmt.Errorf(\"metadata diff doesn't support difftype %s\", optsDiffType),\n\t\t\t\t)\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\top := genOpName(cmd, \"RunE\")\n\t\t\topts.Args = args\n\n\t\t\topts.DisableColor = ec.NoColor\n\n\t\t\terr := opts.Run()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.E(op, err)\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/metadata_diff.go#L57-L93","documentation":"A cobra flag-validation error for `hasura metadata diff`: the --type-of-diff flag value is checked against the supported list and any value not present causes this error naming the offending difftype. Supported values include plain human, json, unified-yaml, unified-json (per the diffTypes slice). Pure input validation; nothing is fetched from the server before this fires.","triggerScenarios":"Passing an unsupported value to --type-of-diff, e.g. `hasura metadata diff --type-of-diff xml` or a misspelling like 'unified_yaml' (underscore instead of hyphen) — exact string membership in diffTypes is required.","commonSituations":"Typos, using underscores instead of hyphens, scripts written against a different CLI version with renamed diff types, or forgetting that the value is case-sensitive.","solutions":["Use a supported difftype: run `hasura metadata diff --help` to list them for your version","Check spelling and separators (hyphens not underscores, exact case)","Upgrade/downgrade the CLI to the version your scripts were written for"],"exampleFix":"# before\nhasura metadata diff --type-of-diff unified_json\n# after\nhasura metadata diff --type-of-diff unified-json","handlingStrategy":"validation","validationCode":"# Shell: enforce supported difftypes in wrappers\nDIFFTYPE=\"$1\"\ncase \"$DIFFTYPE\" in\n  human|json|unified-yaml|unified-json) ;;\n  *) echo \"unsupported difftype: $DIFFTYPE\"; exit 2 ;;\nesac\nhasura metadata diff --type-of-diff \"$DIFFTYPE\"","typeGuard":"// Go\nfunc isSupportedDiffType(t DiffType, supported []DiffType) bool {\n  return slices.Contains(supported, t)\n}","tryCatchPattern":null,"preventionTips":["Use exact hyphenated values (unified-json, not unified_json)","Pin the CLI version your automation scripts target"],"tags":["validation","flag","metadata-diff","cli"],"backgroundTag":"invalid-argument-value","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}