{"record":{"id":"e47657b84b892fa6","repo":"mikefarah/yq","slug":"v-not-yet-supported-for-comparison","errorCode":null,"errorMessage":"%v not yet supported for comparison","messagePattern":"(.+?) not yet supported for comparison","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/yqlib/operator_compare.go","lineNumber":131,"sourceCode":"\t\tif prefs.Greater {\n\t\t\treturn lhsNum > rhsNum, nil\n\t\t}\n\t\treturn lhsNum < rhsNum, nil\n\t} else if lhsTag == \"!!str\" && rhsTag == \"!!str\" {\n\t\tif prefs.OrEqual && lhs.Value == rhs.Value {\n\t\t\treturn true, nil\n\t\t}\n\t\tif prefs.Greater {\n\t\t\treturn lhs.Value > rhs.Value, nil\n\t\t}\n\t\treturn lhs.Value < rhs.Value, nil\n\t} else if lhsTag == \"!!null\" && rhsTag == \"!!null\" && prefs.OrEqual {\n\t\treturn true, nil\n\t} else if lhsTag == \"!!null\" || rhsTag == \"!!null\" {\n\t\treturn false, nil\n\t}\n\n\treturn false, fmt.Errorf(\"%v not yet supported for comparison\", lhs.Tag)\n}\n\nfunc superlativeByComparison(d *dataTreeNavigator, context Context, prefs compareTypePref) (Context, error) {\n\tfn := compare(prefs)\n\n\tvar results = list.New()\n\n\tfor seq := context.MatchingNodes.Front(); seq != nil; seq = seq.Next() {\n\t\tsplatted, err := splat(context.SingleChildContext(seq.Value.(*CandidateNode)), traversePreferences{})\n\t\tif err != nil {\n\t\t\treturn Context{}, err\n\t\t}\n\t\tresult := splatted.MatchingNodes.Front()\n\t\tif result != nil {\n\t\t\tfor el := result.Next(); el != nil; el = el.Next() {\n\t\t\t\tcmp, err := fn(d, context, el.Value.(*CandidateNode), result.Value.(*CandidateNode))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn Context{}, err","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/mikefarah/yq/blob/8b5af0694bb82b41d4ae180fac9972029066f90a/pkg/yqlib/operator_compare.go#L113-L149","documentation":"compareScalars implements ordering only for int/float pairs, string pairs, timestamps, and null. If the lhs tag falls outside every supported branch (e.g. !!bool, custom tags that do not resolve, !!merge), it falls through to this error. The rhs may be fine; it is specifically the lhs tag that yq does not know how to order.","triggerScenarios":"Comparing boolean values with <, <=, >, >=, e.g. `yq '.enabled > .verbose' file.yaml` where both are !!bool; comparing a custom-typed node whose guessTagFromCustomType does not reduce to str/int/float/null; sort_by/min/max over sequences of booleans or other untagged-unsupported scalars.","commonSituations":"Sorting or min/max over boolean flags in config files; comparing env-style 'true'/'false' strings that yq parsed as !!bool; data produced by tools that emit exotic tags (e.g. !!binary) fed into ordering expressions; users expecting bools to be orderable like in Python (False < True).","solutions":["Convert booleans to numbers before comparing: `.enabled | tonumber`-style, or compare with ==/!= which works for bools.","If sorting bools, map them to ints first: `sort_by(.enabled == true)` or use select-based filtering instead of ordering.","Inspect the actual tags with `yq '... | tag'` to confirm both operands are str/int/float.","Explicitly cast strings: if 'true' is really a string, ensure quoting so the tag is !!str and string comparison applies."],"exampleFix":"# before\nyq 'sort_by(.enabled)' file.yaml    # .enabled is !!bool -> error\n# after\nyq 'sort_by(.enabled == \"true\" or .enabled == true)' file.yaml   # or compare with == instead of ordering","handlingStrategy":"type-guard","validationCode":"# verify operand tags are orderable (str/int/float) before comparing:\nyq -e '.enabled | tag == \"!!str\" or tag == \"!!int\" or tag == \"!!float\"' file.yaml || echo \"unorderable tag\"","typeGuard":"// yq expression guard: restrict ordering comparisons to numeric/string tags\n// yq 'select(tag == \"!!int\" or tag == \"!!float\" or tag == \"!!str\") | . > .other' file.yaml","tryCatchPattern":null,"preventionTips":["Do not use <,<=,>,>= on booleans; use ==/!= or map to numbers","Check tags with `tag` when comparing values from external tools","Convert booleans/enums to comparable scalars before sort_by/min/max","Avoid custom-tagged nodes in ordering expressions unless they resolve to str/int/float"],"tags":["yq","comparison-operator","unsupported-type","scalar-tag"],"backgroundTag":"comparison-not-supported-for-type","analyzedSha":"8b5af0694bb82b41d4ae180fac9972029066f90a","analyzedAt":"2026-09-05T10:57:22.766Z","contentChangedAt":"2026-09-05T10:57:22.766Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}