ruby/rubygems · error · InvalidOption
15
15
Error message
You passed #{invalid_keys} as options for #{command}, but they are invalid. Valid options are: #{valid_keys}. You may be able to resolve this by upgrading Bundler to the newest version. What it means
Error "You passed #{invalid_keys} as options for #{command}, but they are invalid. Valid options are: #{valid_keys}. You may be able to resolve this by upgrading Bundler to the newest version." thrown in ruby/rubygems.
Source
Thrown at lib/bundler/dsl.rb:562
def validate_keys(command, opts, valid_keys)
if opts["branch"] && !(opts["git"] || opts["github"] || (opts.keys & @git_sources.keys.map(&:to_s)).any?)
raise GemfileError, %(The `branch` option for `#{command}` is not allowed. Only gems with a git source can specify a branch)
end
invalid_keys = opts.keys - valid_keys
return true unless invalid_keys.any?
message = String.new
message << "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} "
message << if invalid_keys.size > 1
"as options for #{command}, but they are invalid."
else
"as an option for #{command}, but it is invalid."
end
message << " Valid options are: #{valid_keys.join(", ")}."
message << " You may be able to resolve this by upgrading Bundler to the newest version."
raise InvalidOption, message
end
def normalize_source(source)
case source
when :gemcutter, :rubygems, :rubyforge
removed_message =
"The source :#{source} is disallowed because HTTP requests are insecure.\n" \
"Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not."
Bundler::SharedHelpers.feature_removed! removed_message
when String
source
else
raise GemfileError, "Unknown source '#{source}'"
end
end
def check_path_source_safety
return if @sources.global_path_source.nil?View on GitHub (pinned to 86cbb817a3)
When it happens
Trigger: Thrown at lib/bundler/dsl.rb:562 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/364b1c17024a149e.
Report an issue: GitHub.