{"record":{"id":"3acfd1eaaa0e3120","repo":"flippercloud/flipper","slug":"data-type-is-not-supported-by-this-adapter-3acfd1","errorCode":null,"errorMessage":"#{data_type} is not supported by this adapter","messagePattern":"#(.+?) is not supported by this adapter","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"lib/flipper/adapters/mongo.rb","lineNumber":139,"sourceCode":"\n      private\n\n      def read_feature_keys\n        find(@features_key).fetch('features') { Set.new }.to_set\n      end\n\n      def read_many_features(features)\n        docs = find_many(features.map(&:key))\n        result = {}\n        features.each do |feature|\n          result[feature.key] = result_for_feature(feature, docs.fetch(feature.key, {}))\n        end\n        result\n      end\n\n      # Private\n      def unsupported_data_type(data_type)\n        raise \"#{data_type} is not supported by this adapter\"\n      end\n\n      # Private\n      def find(key)\n        @collection.find(_id: key.to_s).limit(1).first || {}\n      end\n\n      def find_many(keys)\n        docs = @collection.find(_id: { '$in' => keys }).to_a\n        result = {}\n        docs.each do |doc|\n          result[doc['_id']] = doc\n        end\n        result\n      end\n\n      # Private\n      def update(key, updates)","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/flippercloud/flipper/blob/1f86de3ec91521585b156445e156642938b19cb0/lib/flipper/adapters/mongo.rb#L121-L157","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Verify after bundling: Gem.loaded_specs['flipper'].version must equal Gem.loaded_specs['flipper-mongo'].version; add this as a boot check.","Until the adapter is upgraded, stop writing and reading expression gates through it (skip feature.enable_expression and the UI conditions editor).","If the failing gate is custom, use one of the four supported data types instead of a novel one."],"exampleFix":"# before — core supports expressions, adapter predates the :json branch\ngem 'flipper',    '~> 0.28.0'\ngem 'flipper-mongo', '~> 0.25.0'\n\n# after — flipper gems version in lockstep; keep them identical\ngem 'flipper',    '~> 0.28.0'\ngem 'flipper-mongo', '~> 0.28.0'","handlingStrategy":"validation","validationCode":"def assert_flipper_gems_aligned!\n  core = Gem.loaded_specs.fetch('flipper').version\n  adapter = Gem.loaded_specs.fetch('flipper-mongo').version\n  raise \"flipper-mongo #{adapter} != flipper #{core}; align both gems\" unless core == adapter\nend\n\nassert_flipper_gems_aligned! # call at boot, before any enable_expression","typeGuard":"def adapter_supports_data_type?(adapter, data_type)\n  supported = %i[boolean integer set json]\n  supported.include?(data_type)\nend","tryCatchPattern":"begin\n  feature.enable_expression(expr)\nrescue RuntimeError => e\n  if e.message.end_with?('is not supported by this adapter')\n    Flipper.logger.warn(\"flipper-mongo lacks support for this gate; falling back to percentage rollout\")\n    feature.enable_percentage_of_time(10)\n  else\n    raise\n  end\nend","preventionTips":["Treat flipper and flipper-mongo as one unit: bump and lock them to identical versions in the same PR.","Add a boot assertion comparing Gem.loaded_specs versions of core and adapter.","When multiple apps share one MongoDB collection, upgrade all writers and readers before the first app starts using expression gates.","Do not introduce custom gate data types; serialize with :json instead."],"tags":["ruby","flipper","mongodb","adapter","gates","version-mismatch","expression-gate"],"backgroundTag":"unsupported-adapter-data-type","analyzedSha":"1f86de3ec91521585b156445e156642938b19cb0","analyzedAt":"2026-08-23T04:36:09.896Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}