{"record":{"id":"ef32e7d520f8af86","repo":"mikefarah/yq","slug":"any-only-supports-arrays-was-v","errorCode":null,"errorMessage":"any only supports arrays, was %v","messagePattern":"any only supports arrays, was (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/yqlib/operator_booleans.go","lineNumber":109,"sourceCode":"\t\t\treturn Context{}, fmt.Errorf(\"all only supports arrays, was %v\", candidate.Tag)\n\t\t}\n\t\tbooleanResult, err := findBoolean(false, d, context, expressionNode.RHS, candidate)\n\t\tif err != nil {\n\t\t\treturn Context{}, err\n\t\t}\n\t\tresult := createBooleanCandidate(candidate, !booleanResult)\n\t\tresults.PushBack(result)\n\t}\n\treturn context.ChildContext(results), nil\n}\n\nfunc anyOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {\n\tvar results = list.New()\n\n\tfor el := context.MatchingNodes.Front(); el != nil; el = el.Next() {\n\t\tcandidate := el.Value.(*CandidateNode)\n\t\tif candidate.Kind != SequenceNode {\n\t\t\treturn Context{}, fmt.Errorf(\"any only supports arrays, was %v\", candidate.Tag)\n\t\t}\n\t\tbooleanResult, err := findBoolean(true, d, context, expressionNode.RHS, candidate)\n\t\tif err != nil {\n\t\t\treturn Context{}, err\n\t\t}\n\t\tresult := createBooleanCandidate(candidate, booleanResult)\n\t\tresults.PushBack(result)\n\t}\n\treturn context.ChildContext(results), nil\n}\n\nfunc orOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {\n\tprefs := crossFunctionPreferences{\n\t\tCalcWhenEmpty:  true,\n\t\tCalculation:    returnRhsTruthy,\n\t\tLhsResultValue: returnLHSWhen(true),\n\t}\n\treturn crossFunctionWithPrefs(d, context.ReadOnlyClone(), expressionNode, prefs)","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/mikefarah/yq/blob/8b5af0694bb82b41d4ae180fac9972029066f90a/pkg/yqlib/operator_booleans.go#L91-L127","documentation":"The any operator, like all, requires each matched node to be a SequenceNode so it can test its predicate over the elements. This guard fires on the first matched node whose tag is not !!seq (the actual tag replaces %v), e.g. running any directly against a map value or a scalar.","triggerScenarios":"Thrown at pkg/yqlib/operator_booleans.go:109 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Apply any only to arrays: .tags | any(. == \"x\")","Convert to an array first with [...] or [.[] | ... ]","Verify upstream that the field exists and is a list, not a scalar/map"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}