flippercloud/flipper · error · RuntimeError

#{data_type} is not supported by this adapter

Error message

#{data_type} is not supported by this adapter

What it means

flipper-mongo stores each gate on a document keyed by feature, choosing the storage operation from the gate's data type; when enable, disable, or result_for_feature meet a data type with no branch, they call unsupported_data_type, which raises this error (lib/flipper/adapters/mongo.rb:138-140). The supported set is :boolean, :integer, :set and :json — :json being what the expression gate reports. flipper-mongo is a separate gem from flipper core and Bundler resolves them independently, so the classic producer is a newer flipper core (with expression gates) paired with an older flipper-mongo that predates :json support.

Source

Thrown at lib/flipper/adapters/mongo.rb:139

      private

      def read_feature_keys
        find(@features_key).fetch('features') { Set.new }.to_set
      end

      def read_many_features(features)
        docs = find_many(features.map(&:key))
        result = {}
        features.each do |feature|
          result[feature.key] = result_for_feature(feature, docs.fetch(feature.key, {}))
        end
        result
      end

      # Private
      def unsupported_data_type(data_type)
        raise "#{data_type} is not supported by this adapter"
      end

      # Private
      def find(key)
        @collection.find(_id: key.to_s).limit(1).first || {}
      end

      def find_many(keys)
        docs = @collection.find(_id: { '$in' => keys }).to_a
        result = {}
        docs.each do |doc|
          result[doc['_id']] = doc
        end
        result
      end

      # Private
      def update(key, updates)

View on GitHub (pinned to 1f86de3ec9)

Solutions

  1. Align gem versions — every flipper gem releases in lockstep: run bundle update flipper flipper-mongo (or pin both to the same version) so enable/disable/result_for_feature include the :json branch.
  2. Verify after bundling: Gem.loaded_specs['flipper'].version must equal Gem.loaded_specs['flipper-mongo'].version; add this as a boot check.
  3. Until the adapter is upgraded, stop writing and reading expression gates through it (skip feature.enable_expression and the UI conditions editor).
  4. If the failing gate is custom, use one of the four supported data types instead of a novel one.

Example fix

# before — core supports expressions, adapter predates the :json branch
gem 'flipper',    '~> 0.28.0'
gem 'flipper-mongo', '~> 0.25.0'

# after — flipper gems version in lockstep; keep them identical
gem 'flipper',    '~> 0.28.0'
gem 'flipper-mongo', '~> 0.28.0'
Defensive patterns

Strategy: validation

Validate before calling

def assert_flipper_gems_aligned!
  core = Gem.loaded_specs.fetch('flipper').version
  adapter = Gem.loaded_specs.fetch('flipper-mongo').version
  raise "flipper-mongo #{adapter} != flipper #{core}; align both gems" unless core == adapter
end

assert_flipper_gems_aligned! # call at boot, before any enable_expression

Type guard

def adapter_supports_data_type?(adapter, data_type)
  supported = %i[boolean integer set json]
  supported.include?(data_type)
end

Try / catch

begin
  feature.enable_expression(expr)
rescue RuntimeError => e
  if e.message.end_with?('is not supported by this adapter')
    Flipper.logger.warn("flipper-mongo lacks support for this gate; falling back to percentage rollout")
    feature.enable_percentage_of_time(10)
  else
    raise
  end
end

Prevention

When it happens

Trigger: feature.enable_expression(expr) / feature.add_expression (or Flipper Cloud sync / the UI conditions editor writing expression gates) against a flipper-mongo release whose enable/disable still call unsupported_data_type(:json); reads raise too, since result_for_feature on the get path uses the same helper. A custom Gate with a data_type outside %i[boolean integer set json] triggers it on any release.

Common situations: Gemfile lines like gem 'flipper', '~> 0.28' while the lockfile keeps an older flipper-mongo; rolling out expression-based targeting without bumping the adapter gem; two apps sharing a MongoDB collection where a newer app writes expression documents that an older app then enables/disables/reads.

Related errors


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