{"record":{"id":"9c7dc7acffad1880","repo":"heartcombo/devise","slug":"name","errorCode":null,"errorMessage":"#{name}","messagePattern":"#\\{name\\}","errorType":"exception","errorClass":"Devise::OmniAuth::StrategyNotFound","httpStatus":null,"severity":"error","filePath":"lib/devise/omniauth/config.rb","lineNumber":42,"sourceCode":"      end\n\n      def strategy_class\n        @strategy_class ||= find_strategy || autoload_strategy\n      end\n\n      def find_strategy\n        ::OmniAuth.strategies.find do |strategy_class|\n          strategy_class.to_s =~ /#{::OmniAuth::Utils.camelize(strategy_name)}$/ ||\n            strategy_class.default_options[:name] == strategy_name\n        end\n      end\n\n      def autoload_strategy\n        name = ::OmniAuth::Utils.camelize(provider.to_s)\n        if ::OmniAuth::Strategies.const_defined?(name)\n          ::OmniAuth::Strategies.const_get(name)\n        else\n          raise StrategyNotFound, name\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":24,"sourceCodeEnd":48,"githubUrl":"https://github.com/heartcombo/devise/blob/372b295fe6f63b4af3269f5dcd51a18c0bc2016c/lib/devise/omniauth/config.rb#L24-L48","documentation":"When you configure an OmniAuth provider (config.omniauth :facebook, ...) or declare omniauth_providers on a model, Devise::OmniAuth::Config#strategy_class resolves the provider name to a strategy class: first by scanning OmniAuth.strategies for a registered match, then by trying to autoload OmniAuth::Strategies::<CamelizedProvider>. If neither finds a class, autoload_strategy raises StrategyNotFound (subclass of NameError) with the camelized provider name. The usual root cause is that the omniauth-<provider> gem is not in the bundle or not loaded.","triggerScenarios":"config.omniauth :facebook, \"APP_ID\", \"SECRET\" in config/initializers/devise.rb without gem \"omniauth-facebook\" in the Gemfile; a typo in the provider symbol (config.omniauth :gihub ...); model declares devise :omniauthable, omniauth_providers: [:google_oauth2] but omniauth-google-oauth2 is missing; OmniAuth 2.x setup where a legacy gem version no longer registers its strategy; an in-house strategy that was never registered and no :strategy_class option was given.","commonSituations":"Enabling OAuth login incrementally (routes/model configured, gem forgotten); upgrading from OmniAuth 1.x to 2.x, which requires newer provider gems; typo'd provider names; using custom strategies without passing strategy_class: MyStrategy in the config.omniauth options hash; gem present but not required before the Devise initializer runs.","solutions":["Add the matching provider gem to the Gemfile and bundle install: gem \"omniauth-facebook\" for :facebook, gem \"omniauth-google-oauth2\" for :google_oauth2, then restart the server.","Fix the provider symbol spelling so Devise::OmniAuth::Utils.camelize(name) matches the gem's strategy class (e.g. :google_oauth2 -> OmniAuth::Strategies::GoogleOauth2).","For custom/in-house strategies, pass the class explicitly: config.omniauth :sso, \"id\", \"secret\", strategy_class: MySsoStrategy.","If the gem is present but the error persists, ensure it is required before Devise's initializer (Bundler.require order / require it at the top of the initializer) and stop stale processes: bin/spring stop."],"exampleFix":"# before (Gemfile — no provider gem)\ngem \"devise\"\n\n# config/initializers/devise.rb\nDevise.setup do |config|\n  config.omniauth :facebook, ENV[\"FB_ID\"], ENV[\"FB_SECRET\"]\nend\n# -> boot fails: StrategyNotFound \"Facebook\"\n\n# after (Gemfile)\ngem \"omniauth-facebook\", \"~> 8.0\"\ngem \"omniauth-rails_csrf_protection\"\n\n# config/initializers/devise.rb (unchanged, now resolves OmniAuth::Strategies::Facebook)\nDevise.setup do |config|\n  config.omniauth :facebook, ENV[\"FB_ID\"], ENV[\"FB_SECRET\"]\nend","handlingStrategy":"validation","validationCode":"# Before boot depends on a provider, assert its strategy resolves:\ndef omniauth_strategy_available?(provider)\n  name = ::OmniAuth::Utils.camelize(provider.to_s)\n  ::OmniAuth.strategies.any? { |s| s.to_s =~ /#{name}$/ } ||\n    ::OmniAuth::Strategies.const_defined?(name)\nend\n\n# config/initializers/devise.rb\nRails.application.config.after_initialize do\n  Devise.omniauth_configs.each_key do |provider|\n    unless omniauth_strategy_available?(provider)\n      raise \"Add the omniauth-#{provider} gem or pass strategy_class for #{provider}\"\n    end\n  end\nend","typeGuard":"def omniauth_provider_configured?(provider)\n  Devise.omniauth_configs.key?(provider) &&\n    omniauth_strategy_available?(provider)\nend","tryCatchPattern":"# Give a clearer boot failure naming the missing gem:\nbegin\n  Devise.setup do |config|\n    config.omniauth :facebook, ENV.fetch(\"FB_ID\"), ENV.fetch(\"FB_SECRET\")\n  end\nrescue Devise::OmniAuth::StrategyNotFound => e\n  raise \"#{e.message} Add gem 'omniauth-facebook' to the Gemfile and bundle install.\"\nend","preventionTips":["Add the omniauth-<provider> gem in the same commit that adds config.omniauth / omniauth_providers.","After configuring a provider, run rails runner 'Devise.omniauth_configs.each { |k, v| p k => v.strategy_class }' to confirm every strategy resolves.","For custom strategies, always pass strategy_class: MyStrategy in the config.omniauth options hash.","On OmniAuth 2.x upgrades, verify all provider gems are 2.x-compatible — old versions may not register strategies."],"tags":["devise","omniauth","rails","missing-gem","authentication","boot-error"],"backgroundTag":"omniauth-strategy-not-found","analyzedSha":"372b295fe6f63b4af3269f5dcd51a18c0bc2016c","analyzedAt":"2026-08-21T11:55:31.116Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}