{"record":{"id":"dd929d57c036ff95","repo":"ruby/rubygems","slug":"no-key-for-host-host-in-s3-source-in-gemrc","errorCode":null,"errorMessage":"no key for host #{host} in s3_source in .gemrc","messagePattern":"no key for host #(.+?) in s3_source in \\.gemrc","errorType":"exception","errorClass":"Gem::S3URISigner::ConfigurationError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/s3_uri_signer.rb","lineNumber":118,"sourceCode":"  def generate_signature(s3_config, date, string_to_sign)\n    date_key = OpenSSL::HMAC.digest(\"sha256\", \"AWS4\" + s3_config.secret_access_key, date)\n    date_region_key = OpenSSL::HMAC.digest(\"sha256\", date_key, s3_config.region)\n    date_region_service_key = OpenSSL::HMAC.digest(\"sha256\", date_region_key, \"s3\")\n    signing_key = OpenSSL::HMAC.digest(\"sha256\", date_region_service_key, \"aws4_request\")\n    OpenSSL::HMAC.hexdigest(\"sha256\", signing_key, string_to_sign)\n  end\n\n  ##\n  # Extracts S3 configuration for S3 bucket\n  def fetch_s3_config\n    return S3Config.new(uri.user, uri.password, nil, \"us-east-1\") if uri.user && uri.password\n\n    s3_source = Gem.configuration[:s3_source] || Gem.configuration[\"s3_source\"]\n    host = uri.host\n    raise ConfigurationError.new(\"no s3_source key exists in .gemrc\") unless s3_source\n\n    auth = s3_source[host] || s3_source[host.to_sym]\n    raise ConfigurationError.new(\"no key for host #{host} in s3_source in .gemrc\") unless auth\n\n    provider = auth[:provider] || auth[\"provider\"]\n    case provider\n    when \"env\"\n      id = ENV[\"AWS_ACCESS_KEY_ID\"]\n      secret = ENV[\"AWS_SECRET_ACCESS_KEY\"]\n      security_token = ENV[\"AWS_SESSION_TOKEN\"]\n    when \"instance_profile\"\n      credentials = ec2_metadata_credentials_json\n      id = credentials[\"AccessKeyId\"]\n      secret = credentials[\"SecretAccessKey\"]\n      security_token = credentials[\"Token\"]\n    else\n      id = auth[:id] || auth[\"id\"]\n      secret = auth[:secret] || auth[\"secret\"]\n      security_token = auth[:security_token] || auth[\"security_token\"]\n    end\n","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/s3_uri_signer.rb#L100-L136","documentation":"Error \"no key for host #{host} in s3_source in .gemrc\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/s3_uri_signer.rb:118 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add an entry for the reported host under s3_source in ~/.gemrc"],"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"}