{"record":{"id":"565b619d8914867c","repo":"flippercloud/flipper","slug":"expression-value-inspect-contains-empty-any-all","errorCode":null,"errorMessage":"#{expression.value.inspect} contains empty Any/All groups and cannot be enabled (an empty All matches every actor, an empty Any matches none). Remove the empty groups or add conditions to them.","messagePattern":"#(.+?) contains empty Any/All groups and cannot be enabled \\(an empty All matches every actor, an empty Any matches none\\)\\. Remove the empty groups or add conditions to them\\.","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/flipper/feature.rb","lineNumber":472,"sourceCode":"        validate_expression!(wrapped_thing) if validate_expression\n\n        adapter.add self\n\n        payload[:gate_name] = gate.name\n        payload[:thing] = wrapped_thing\n\n        adapter.enable self, gate, wrapped_thing\n      end\n    end\n\n    # Private: Raises if an expression about to be enabled contains empty\n    # Any/All groups. An empty All evaluates to true for every actor, so\n    # persisting one silently enables the feature for everyone.\n    #\n    # Returns the expression.\n    def validate_expression!(expression)\n      if expression.is_a?(Expression) && expression.empty_groups?\n        raise ArgumentError, \"#{expression.value.inspect} contains empty Any/All groups and cannot be enabled (an empty All matches every actor, an empty Any matches none). Remove the empty groups or add conditions to them.\"\n      end\n\n      expression\n    end\n\n    # Private: Wrap the actors passed to enabled? in a single pass to avoid\n    # intermediate array allocations on the hot path. Arrays are flattened one\n    # level; the explicit is_a?(Array) check (instead of flatten) avoids the\n    # to_ary warning that happens when passing a DelegateClass of an\n    # ActiveRecord object. This is tested in\n    # spec/flipper/model/active_record_spec.rb. Nils are dropped to allow the\n    # null object pattern. See https://github.com/flippercloud/flipper/pull/887\n    #\n    # Returns an Array of Types::Actor instances or nil if no actors.\n    def wrap_actors(actors)\n      return nil if actors.empty?\n\n      wrapped = []","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/flippercloud/flipper/blob/1f86de3ec91521585b156445e156642938b19cb0/lib/flipper/feature.rb#L454-L490","documentation":"Error \"#{expression.value.inspect} contains empty Any/All groups and cannot be enabled (an empty All matches every actor, an empty Any matches none). Remove the empty groups or add conditions to them.\" thrown in flippercloud/flipper.","triggerScenarios":"Thrown at lib/flipper/feature.rb:472 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add at least one condition to the empty Any/All group, or remove the empty group from the expression","Sanitize stored expressions before enabling to strip empty groups","Recreate the expression via the API/UI so empty groups are not persisted"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1f86de3ec91521585b156445e156642938b19cb0","analyzedAt":"2026-08-23T04:36:09.896Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}