{"record":{"id":"768336ea430ee8e8","repo":"ruby/ruby","slug":"15","errorCode":"15","errorMessage":"The request uri `#{uri}` has an invalid scheme (`#{uri.scheme}`). Did you mean `http` or `https`?","messagePattern":"The request uri `#(.+?)` has an invalid scheme \\(`#(.+?)`\\)\\. Did you mean `http` or `https`\\?","errorType":"validation","errorClass":"Bundler::InvalidOption","httpStatus":null,"severity":"error","filePath":"lib/bundler/fetcher/downloader.rb","lineNumber":125,"sourceCode":"        Bundler.ui.trace e\n\n        raise HTTPError, \"Network error while fetching #{filtered_uri}\" \\\n            \" (#{e})\"\n      end\n\n      private\n\n      def network_down_error(uri, filtered_uri)\n        host = uri.host\n        host_port = \"#{host}:#{uri.port}\"\n        host = host_port if filtered_uri.to_s.include?(host_port)\n        NetworkDownError.new(\"Could not reach host #{host}. Check your network \" \\\n          \"connection and try again.\")\n      end\n\n      def validate_uri_scheme!(uri)\n        return if /\\Ahttps?\\z/.match?(uri.scheme)\n        raise InvalidOption,\n          \"The request uri `#{uri}` has an invalid scheme (`#{uri.scheme}`). \" \\\n          \"Did you mean `http` or `https`?\"\n      end\n    end\n  end\nend\n","sourceCodeStart":107,"sourceCodeEnd":132,"githubUrl":"https://github.com/ruby/ruby/blob/0e5b888e1c355f3f728f2659f085820937dada48/lib/bundler/fetcher/downloader.rb#L107-L132","documentation":"Downloader#validate_uri_scheme! runs before every request and rejects any URI whose scheme is not exactly `http` or `https` (case-sensitive, anchored match). It raises Bundler::InvalidOption, listing the offending URI and scheme, because RubyGems' fetcher only speaks HTTP(S).","triggerScenarios":"A Gemfile source like `source \"rubygems.org\"` (no scheme, uri.scheme is nil), `source \"git://github.com/...\"`, `gem \"x\", source: \"ftp://mirror/...\"`, or a typo such as `https ://` or `HTTPS://` (the anchor match is lowercase-only).","commonSituations":"Hand-editing the Gemfile and dropping the scheme; copying a bare host from docs; legacy Gemfiles using git:// URLs that hosts have disabled; template variables producing empty schemes.","solutions":["Add or correct the scheme on every source/gem-source URL in the Gemfile to lowercase `http` or `https`.","Prefer https; replace git:// URLs with https ones.","If a non-HTTP source is intended (local path, git), use the proper DSL (`source \"...\", type:` plugin, `gem \"x\", path:`/`git:`) instead of a source URL."],"exampleFix":"# Gemfile\n# before\nsource \"rubygems.org\"\ngem \"rails\", source: \"git://internal.mirror\"\n\n# after\nsource \"https://rubygems.org\"\ngem \"rails\", source: \"https://internal.mirror\"","handlingStrategy":"validation","validationCode":"# lint every source URL before running bundler\nrequire \"uri\"\n\nsources = File.readlines(\"Gemfile\").grep(/^\\s*source\\s+\")\").map { _1[/source\\s+\")([^\"]+)\"\\)/, 1] }\nbad = sources.reject { |s| /\\Ahttps?\\z/.match?(URI(s).scheme) }\nabort \"invalid source schemes: #{bad.join(', ')}\" unless bad.empty?","typeGuard":null,"tryCatchPattern":"begin\n  definition.resolve_remotely!\nrescue Bundler::InvalidOption => e\n  abort \"fix Gemfile source URL: #{e.message}\" if e.message.include?(\"invalid scheme\")\n  raise\nend","preventionTips":["Always paste full URLs including lowercase https:// into source lines.","Add a Gemfile lint step (the validation snippet) to CI or a pre-commit hook.","Replace legacy git:// URLs with https:// when touching old Gemfiles."],"tags":["bundler","uri","validation","gemfile","configuration"],"backgroundTag":"invalid-url-scheme","analyzedSha":"0e5b888e1c355f3f728f2659f085820937dada48","analyzedAt":"2026-08-21T14:25:43.473Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}