ruby/rubygems · error · Bundler::InvalidOption
Invalid gem requirement pattern '#{v}'
Error message
Invalid gem requirement pattern '#{v}' What it means
Error "Invalid gem requirement pattern '#{v}'" thrown in ruby/rubygems.
Source
Thrown at lib/bundler/cli/add.rb:58
def validate_options!
raise InvalidOption, "You cannot specify `--git` and `--github` at the same time." if options["git"] && options["github"]
unless options["git"] || options["github"]
raise InvalidOption, "You cannot specify `--branch` unless `--git` or `--github` is specified." if options["branch"]
raise InvalidOption, "You cannot specify `--ref` unless `--git` or `--github` is specified." if options["ref"]
end
raise InvalidOption, "You cannot specify `--branch` and `--ref` at the same time." if options["branch"] && options["ref"]
raise InvalidOption, "You cannot specify `--strict` and `--pessimistic` at the same time." if options[:strict] && options[:pessimistic]
# raise error when no gems are specified
raise InvalidOption, "Please specify gems to add." if gems.empty?
version.to_a.each do |v|
raise InvalidOption, "Invalid gem requirement pattern '#{v}'" unless Gem::Requirement::PATTERN.match?(v.to_s)
end
end
end
end
View on GitHub (pinned to 86cbb817a3)
When it happens
Trigger: Thrown at lib/bundler/cli/add.rb:58 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ruby/rubygems@86cbb817a3 (2026-08-23).
Data as JSON: /api/errors/a93fe26b3401bfe2.
Report an issue: GitHub.