ruby/rubygems · error · Bundler::InvalidOption
Only one of --source, --git, or --path may be specified
Error message
Only one of --source, --git, or --path may be specified
What it means
Error "Only one of --source, --git, or --path may be specified" thrown in ruby/rubygems.
Source
Thrown at lib/bundler/plugin/installer.rb:53
def install_definition(definition, latest = false)
def definition.lock(*); end
if latest || definition.missing_specs?
definition.remotely!
else
definition.with_cache!
end
specs = definition.specs
install_from_specs(specs)
end
private
def check_sources_consistency!(options)
if (options.keys & [:source, :git, :path]).length > 1
raise InvalidOption, "Only one of --source, --git, or --path may be specified"
end
if (options.key?(:branch) || options.key?(:ref)) && !options.key?(:git)
raise InvalidOption, "--#{options.key?(:branch) ? "branch" : "ref"} can only be used with git sources"
end
if options.key?(:branch) && options.key?(:ref)
raise InvalidOption, "--branch and --ref can't be both specified"
end
end
def install_git(names, version, options)
source_list = SourceList.new
source = source_list.add_git_source({ "uri" => options[:git],
"branch" => options[:branch],
"ref" => options[:ref] })
install_all_sources(names, version, source_list, source)View on GitHub (pinned to 86cbb817a3)
When it happens
Trigger: Thrown at lib/bundler/plugin/installer.rb:53 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/a189ccf83d7a524c.
Report an issue: GitHub.