{"record":{"id":"33412b301b206177","repo":"ruby/rubygems","slug":"branch-and-ref-can-t-be-both-specified","errorCode":null,"errorMessage":"--branch and --ref can't be both specified","messagePattern":"--branch and --ref can't be both specified","errorType":"exception","errorClass":"Bundler::InvalidOption","httpStatus":null,"severity":"error","filePath":"lib/bundler/plugin/installer.rb","lineNumber":61,"sourceCode":"\n        specs = definition.specs\n\n        install_from_specs(specs)\n      end\n\n      private\n\n      def check_sources_consistency!(options)\n        if (options.keys & [:source, :git, :path]).length > 1\n          raise InvalidOption, \"Only one of --source, --git, or --path may be specified\"\n        end\n\n        if (options.key?(:branch) || options.key?(:ref)) && !options.key?(:git)\n          raise InvalidOption, \"--#{options.key?(:branch) ? \"branch\" : \"ref\"} can only be used with git sources\"\n        end\n\n        if options.key?(:branch) && options.key?(:ref)\n          raise InvalidOption, \"--branch and --ref can't be both specified\"\n        end\n      end\n\n      def install_git(names, version, options)\n        source_list = SourceList.new\n        source = source_list.add_git_source({ \"uri\" => options[:git],\n                                              \"branch\" => options[:branch],\n                                              \"ref\" => options[:ref] })\n\n        install_all_sources(names, version, source_list, source)\n      end\n\n      def install_path(names, version, path)\n        source_list = SourceList.new\n        source = source_list.add_path_source({ \"path\" => path, \"root_path\" => SharedHelpers.pwd })\n\n        install_all_sources(names, version, source_list, source)\n      end","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/bundler/plugin/installer.rb#L43-L79","documentation":"Error \"--branch and --ref can't be both specified\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/bundler/plugin/installer.rb:61 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"}