ruby/rubygems · error · ArgumentError
Invalid uri scheme for #{value} Preface URLs with one of ["h
Error message
Invalid uri scheme for #{value}
Preface URLs with one of ["http://", "https://", "file://", "s3://"] What it means
Error "Invalid uri scheme for #{value} Preface URLs with one of ["http://", "https://", "file://", "s3://"]" thrown in ruby/rubygems.
Source
Thrown at lib/rubygems/local_remote_options.rb:30
##
# Mixin methods for local and remote Gem::Command options.
module Gem::LocalRemoteOptions
##
# Allows Gem::OptionParser to handle HTTP URIs.
def accept_uri_http
Gem::OptionParser.accept Gem::URI::HTTP do |value|
begin
uri = Gem::URI.parse value
rescue Gem::URI::InvalidURIError
raise Gem::OptionParser::InvalidArgument, value
end
valid_uri_schemes = ["http", "https", "file", "s3"]
unless valid_uri_schemes.include?(uri.scheme)
msg = "Invalid uri scheme for #{value}\nPreface URLs with one of #{valid_uri_schemes.map {|s| "#{s}://" }}"
raise ArgumentError, msg
end
value
end
end
##
# Add local/remote options to the command line parser.
def add_local_remote_options
add_option(:"Local/Remote", "-l", "--local",
"Restrict operations to the LOCAL domain") do |_value, options|
options[:domain] = :local
end
add_option(:"Local/Remote", "-r", "--remote",
"Restrict operations to the REMOTE domain") do |_value, options|
options[:domain] = :remoteView on GitHub (pinned to 86cbb817a3)
Solutions
- Preface the URL with one of http://, https://, file://, or s3://
When it happens
Trigger: Thrown at lib/rubygems/local_remote_options.rb:30 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/79e39158a649346d.
Report an issue: GitHub.