{"record":{"id":"6c093e1b71d3d95c","repo":"ruby/rubygems","slug":"cannot-specify-all-along-with-specific-options","errorCode":null,"errorMessage":"Cannot specify --all along with specific options.","messagePattern":"Cannot specify --all along with specific options\\.","errorType":"exception","errorClass":"InvalidOption","httpStatus":null,"severity":"error","filePath":"lib/bundler/cli/update.rb","lineNumber":29,"sourceCode":"    def run\n      Bundler.ui.level = \"warn\" if options[:quiet]\n\n      update_bundler = options[:bundler]\n\n      Bundler.self_manager.update_bundler_and_restart_with_it_if_needed(update_bundler) if update_bundler\n\n      sources = Array(options[:source])\n      groups  = Array(options[:group]).map(&:to_sym)\n\n      full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !update_bundler\n\n      if full_update && !options[:all]\n        if Bundler.settings[:update_requires_all_flag]\n          raise InvalidOption, \"To update everything, pass the `--all` flag.\"\n        end\n        SharedHelpers.feature_deprecated! \"Pass --all to `bundle update` to update everything\"\n      elsif !full_update && options[:all]\n        raise InvalidOption, \"Cannot specify --all along with specific options.\"\n      end\n\n      conservative = options[:conservative]\n\n      unlock = if full_update\n        if conservative\n          { conservative: conservative }\n        else\n          true\n        end\n      else\n        unless Bundler.default_lockfile.exist?\n          raise GemfileLockNotFound, \"This Bundle hasn't been installed yet. \" \\\n            \"Run `bundle install` to update and install the bundled gems.\"\n        end\n        explicit_gems = gems.dup\n\n        if groups.any?","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/bundler/cli/update.rb#L11-L47","documentation":"Bundler raises this Bundler::InvalidOption from the `bundle update` command when the --all flag is combined with any narrowing selector. In lib/bundler/cli/update.rb:21 a full update means no gem names, no --source, no --group, no --ruby and no --bundler; line 28 raises when --all contradicts that. Updating everything and updating a subset are mutually exclusive operations, so bundler aborts before resolution starts.","triggerScenarios":"Commands like `bundle update --all rails`, `bundle update --all --group development`, `bundle update --all --source https://rubygems.org`, `bundle update --all --ruby`, or `bundle update --all --bundler`. Each makes full_update false while options[:all] is set, hitting the elsif at lib/bundler/cli/update.rb:28.","commonSituations":"CI or deploy scripts that accumulated flags over time (update everything plus keep bundler current); copy-pasted commands mixing a targeted update with --all; shell aliases or wrappers that append --all to a user-supplied gem list.","solutions":["Remove --all and keep the targeted update, e.g. `bundle update rails`","Or remove the gem names/groups/sources and run plain `bundle update --all`","For bundler itself use `bundle update --bundler` alone, without --all","For the ruby directive use `bundle update --ruby` alone","Audit wrapper scripts and aliases so --all is never appended when gems are passed"],"exampleFix":"# before\nbundle update --all rails\n# => Cannot specify --all along with specific options.\n\n# after\nbundle update rails","handlingStrategy":"validation","validationCode":"# bash wrapper: refuse --all mixed with selectors before invoking bundler\nif printf '%s\\n' \"$@\" | grep -q -- '--all'; then\n  for a in \"$@\"; do\n    case \"$a\" in\n      --all|--quiet|-*) ;;\n      *) echo \"error: --all cannot be combined with $a\"; exit 64 ;;\n    esac\n  done\nfi\nexec bundle update \"$@\"","typeGuard":null,"tryCatchPattern":"# Ruby-level, when driving the CLI object directly\nbegin\n  Bundler::CLI::Update.new(options, gems).run\nrescue Bundler::InvalidOption => e\n  warn \"usage error: #{e.message}\"\n  exit 64\nend","preventionTips":["Pick one mode per invocation: whole-bundle with --all or targeted with a gem list","Keep --bundler and --ruby in their own dedicated bundle update calls","Log the final command in wrapper scripts so bad flag combinations are visible"],"tags":["bundler","cli","invalid-option","command-arguments"],"backgroundTag":"conflicting-cli-options","analyzedSha":"86cbb817a38ce8477b181c17467a703ded3f2be8","analyzedAt":"2026-08-23T06:27:48.159Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}