flippercloud/flipper · error · ArgumentError

#{expression.value.inspect} contains empty Any/All groups an

Error message

#{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.

What it means

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.

Source

Thrown at lib/flipper/feature.rb:472

        validate_expression!(wrapped_thing) if validate_expression

        adapter.add self

        payload[:gate_name] = gate.name
        payload[:thing] = wrapped_thing

        adapter.enable self, gate, wrapped_thing
      end
    end

    # Private: Raises if an expression about to be enabled contains empty
    # Any/All groups. An empty All evaluates to true for every actor, so
    # persisting one silently enables the feature for everyone.
    #
    # Returns the expression.
    def validate_expression!(expression)
      if expression.is_a?(Expression) && expression.empty_groups?
        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."
      end

      expression
    end

    # Private: Wrap the actors passed to enabled? in a single pass to avoid
    # intermediate array allocations on the hot path. Arrays are flattened one
    # level; the explicit is_a?(Array) check (instead of flatten) avoids the
    # to_ary warning that happens when passing a DelegateClass of an
    # ActiveRecord object. This is tested in
    # spec/flipper/model/active_record_spec.rb. Nils are dropped to allow the
    # null object pattern. See https://github.com/flippercloud/flipper/pull/887
    #
    # Returns an Array of Types::Actor instances or nil if no actors.
    def wrap_actors(actors)
      return nil if actors.empty?

      wrapped = []

View on GitHub (pinned to 1f86de3ec9)

Solutions

  1. Add at least one condition to the empty Any/All group, or remove the empty group from the expression
  2. Sanitize stored expressions before enabling to strip empty groups
  3. Recreate the expression via the API/UI so empty groups are not persisted

When it happens

Trigger: Thrown at lib/flipper/feature.rb:472 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of flippercloud/flipper@1f86de3ec9 (2026-08-23). Data as JSON: /api/errors/565b619d8914867c. Report an issue: GitHub.