{"record":{"id":"0408dbcf165997e7","repo":"ruby/rubygems","slug":"redirecting-but-no-redirect-location-was-given-0408db","errorCode":null,"errorMessage":"redirecting but no redirect location was given","messagePattern":"redirecting but no redirect location was given","errorType":"exception","errorClass":"Gem::RemoteFetcher::FetchError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/remote_fetcher.rb","lineNumber":230,"sourceCode":"  ##\n  # HTTP Fetcher. Dispatched by +fetch_path+. Use it instead.\n\n  def fetch_http(uri, last_modified = nil, head = false, depth = 0)\n    fetch_type = head ? Gem::Net::HTTP::Head : Gem::Net::HTTP::Get\n    response   = request uri, fetch_type, last_modified do |req|\n      headers.each {|k,v| req.add_field(k,v) }\n    end\n\n    case response\n    when Gem::Net::HTTPOK, Gem::Net::HTTPNotModified then\n      response.uri = uri\n      head ? response : response.body\n    when Gem::Net::HTTPMovedPermanently, Gem::Net::HTTPFound, Gem::Net::HTTPSeeOther,\n         Gem::Net::HTTPTemporaryRedirect then\n      raise FetchError.new(\"too many redirects\", uri) if depth > 10\n\n      unless location = response[\"Location\"]\n        raise FetchError.new(\"redirecting but no redirect location was given\", uri)\n      end\n      location = Gem::Uri.new location\n\n      if https?(uri) && !https?(location)\n        raise FetchError.new(\"redirecting to non-https resource: #{location}\", uri)\n      end\n\n      fetch_http(location, last_modified, head, depth + 1)\n    else\n      custom_error = response[\"X-Error-Message\"]\n      error_detail = custom_error || response.message\n      raise FetchError.new(\"Bad response #{error_detail} #{response.code}\", uri)\n    end\n  end\n\n  alias_method :fetch_https, :fetch_http\n\n  ##","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/remote_fetcher.rb#L212-L248","documentation":"Error \"redirecting but no redirect location was given\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/remote_fetcher.rb:230 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The server sent a redirect without a Location header; contact the gem source operator or switch to the canonical source URL"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"86cbb817a38ce8477b181c17467a703ded3f2be8","analyzedAt":"2026-08-23T06:27:48.159Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}