{"record":{"id":"6097b6de2a7ffcd4","repo":"ruby/rubygems","slug":"bad-response-error-detail-response-code","errorCode":null,"errorMessage":"Bad response #{error_detail} #{response.code}","messagePattern":"Bad response #(.+?) #(.+?)","errorType":"exception","errorClass":"Gem::RemoteFetcher::FetchError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/remote_fetcher.rb","lineNumber":242,"sourceCode":"      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  ##\n  # Downloads +uri+ and returns it as a String.\n\n  def fetch_path(uri, mtime = nil, head = false)\n    uri = Gem::Uri.new uri\n\n    method = {\n      \"http\" => \"fetch_http\",\n      \"https\" => \"fetch_http\",\n      \"s3\" => \"fetch_s3\",\n      \"file\" => \"fetch_file\",\n    }.fetch(uri.scheme) { raise ArgumentError, \"uri scheme is invalid: #{uri.scheme.inspect}\" }\n","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/remote_fetcher.rb#L224-L260","documentation":"Error \"Bad response #{error_detail} #{response.code}\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/remote_fetcher.rb:242 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the command; transient server errors often clear","Check proxy settings and the status of the gem source"],"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"}