{"record":{"id":"e3dd99e9653cff3e","repo":"ruby/ruby","slug":"15-e3dd99","errorCode":"15","errorMessage":"You cannot specify `--branch` and `--ref` at the same time.","messagePattern":"You cannot specify `--branch` and `--ref` at the same time\\.","errorType":"validation","errorClass":"Bundler::InvalidOption","httpStatus":null,"severity":"error","filePath":"lib/bundler/plugin.rb","lineNumber":49,"sourceCode":"    def reset!\n      instance_variables.each {|i| remove_instance_variable(i) }\n\n      @sources = {}\n      @commands = {}\n      @hooks_by_event = Hash.new {|h, k| h[k] = [] }\n      @loaded_plugin_names = []\n      @index = nil\n    end\n\n    reset!\n\n    # Installs a new plugin by the given name\n    #\n    # @param [Array<String>] names the name of plugin to be installed\n    # @param [Hash] options various parameters as described in description.\n    #               Refer to cli/plugin for available options\n    def install(names, options)\n      raise InvalidOption, \"You cannot specify `--branch` and `--ref` at the same time.\" if options[\"branch\"] && options[\"ref\"]\n\n      specs = Installer.new.install(names, options)\n\n      save_plugins specs.slice(*names)\n    rescue PluginError\n      specs_to_delete = specs.select {|k, _v| names.include?(k) && !index.commands.values.include?(k) }\n      specs_to_delete.each_value {|spec| Bundler.rm_rf(spec.full_gem_path) }\n\n      raise\n    end\n\n    # Uninstalls plugins by the given names\n    #\n    # @param [Array<String>] names the names of plugins to be uninstalled\n    def uninstall(names, options)\n      if names.empty? && !options[:all]\n        Bundler.ui.error \"No plugins to uninstall. Specify at least 1 plugin to uninstall.\\n\"\\\n          \"Use --all option to uninstall all the installed plugins.\"","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/ruby/ruby/blob/0e5b888e1c355f3f728f2659f085820937dada48/lib/bundler/plugin.rb#L31-L67","documentation":"Raised as Bundler::InvalidOption by Bundler::Plugin.install before the installer runs, when the options hash (string keys, as the CLI passes them) has truthy values for both \"branch\" and \"ref\". It is a fast-fail duplicate of the installer-level consistency check for a request that can never be satisfied: one git checkout cannot honor two different pins.","triggerScenarios":"`bundle plugin install my-plugin --git https://... --branch main --ref abc123` — the CLI forwards both flags, and Plugin#install raises immediately since options[\"branch\"] && options[\"ref\"] is true.","commonSituations":"Scripts that template all pinning flags into one command; shell history editing that appends --ref after --branch without deleting it; documentation examples that show both flags together.","solutions":["Keep only one pinning flag: --branch (moving branch) or --ref (fixed revision), never both","Re-run with a single pin: `bundle plugin install my-plugin --git <url> --ref <sha>`"],"exampleFix":"# before\nbundle plugin install my-plugin --git https://github.com/org/my-plugin.git --branch main --ref abc123\n# after\nbundle plugin install my-plugin --git https://github.com/org/my-plugin.git --branch main","handlingStrategy":"validation","validationCode":"# CLI-style string keys, as Bundler::Plugin.install receives them\nraise ArgumentError, \"branch and ref are mutually exclusive\" if opts[\"branch\"] && opts[\"ref\"]\nBundler::Plugin.install(names, opts)","typeGuard":null,"tryCatchPattern":"begin\n  Bundler::Plugin.install(names, \"git\" => url, \"branch\" => \"main\")\nrescue Bundler::InvalidOption => e\n  abort \"#{e.message}\" # re-prompt the user for a single pin\nend","preventionTips":["In wrappers that forward flags, reject --branch and --ref together up front","Document one canonical pin per plugin install in your project's bootstrap docs"],"tags":["bundler","plugins","cli-options","option-validation"],"backgroundTag":"invalid-option-combination","analyzedSha":"0e5b888e1c355f3f728f2659f085820937dada48","analyzedAt":"2026-08-21T14:25:43.473Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}