{"record":{"id":"338083e50b15fd89","repo":"ruby/rubygems","slug":"plugin-file-name-was-not-found-in-the-plugin","errorCode":null,"errorMessage":"#{PLUGIN_FILE_NAME} was not found in the plugin.","messagePattern":"#(.+?) was not found in the plugin\\.","errorType":"exception","errorClass":"MalformattedPlugin","httpStatus":null,"severity":"error","filePath":"lib/bundler/plugin.rb","lineNumber":307,"sourceCode":"    #\n    # @param [Hash] specs of plugins mapped to installation path (currently they\n    #               contain all the installed specs, including plugins)\n    # @param [Array<String>] names of inferred source plugins that can be ignored\n    def save_plugins(specs, optional_plugins = [])\n      specs.each do |name, spec|\n        save_plugin(name, spec, optional_plugins.include?(name))\n      end\n    end\n\n    # Checks if the gem is good to be a plugin\n    #\n    # At present it only checks whether it contains plugins.rb file\n    #\n    # @param [Pathname] plugin_path the path plugin is installed at\n    # @raise [MalformattedPlugin] if plugins.rb file is not found\n    def validate_plugin!(plugin_path)\n      plugin_file = plugin_path.join(PLUGIN_FILE_NAME)\n      raise MalformattedPlugin, \"#{PLUGIN_FILE_NAME} was not found in the plugin.\" unless plugin_file.file?\n    end\n\n    # Validates and registers a plugin.\n    #\n    # @param [String] name the name of the plugin\n    # @param [Specification] spec of installed plugin\n    # @param [Boolean] optional_plugin, removed if there is conflict with any\n    #                     other plugin (used for default source plugins)\n    #\n    # @raise [PluginInstallError] if validation or registration raises any error\n    def save_plugin(name, spec, optional_plugin = false)\n      return if index.up_to_date?(spec)\n\n      validate_plugin! Pathname.new(spec.full_gem_path)\n      installed = register_plugin(name, spec, optional_plugin)\n      Bundler.ui.info \"Installed plugin #{name}\" if installed\n    rescue PluginError => e\n      raise PluginInstallError, \"Failed to install plugin `#{spec.name}`, due to #{e.class} (#{e.message})\"","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/bundler/plugin.rb#L289-L325","documentation":"Error \"#{PLUGIN_FILE_NAME} was not found in the plugin.\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/bundler/plugin.rb:307 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"86cbb817a38ce8477b181c17467a703ded3f2be8","analyzedAt":"2026-08-23T06:27:48.159Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}