ruby/rubygems · error · Gem::S3URISigner::ConfigurationError
no key for host #{host} in s3_source in .gemrc
Error message
no key for host #{host} in s3_source in .gemrc What it means
Error "no key for host #{host} in s3_source in .gemrc" thrown in ruby/rubygems.
Source
Thrown at lib/rubygems/s3_uri_signer.rb:118
def generate_signature(s3_config, date, string_to_sign)
date_key = OpenSSL::HMAC.digest("sha256", "AWS4" + s3_config.secret_access_key, date)
date_region_key = OpenSSL::HMAC.digest("sha256", date_key, s3_config.region)
date_region_service_key = OpenSSL::HMAC.digest("sha256", date_region_key, "s3")
signing_key = OpenSSL::HMAC.digest("sha256", date_region_service_key, "aws4_request")
OpenSSL::HMAC.hexdigest("sha256", signing_key, string_to_sign)
end
##
# Extracts S3 configuration for S3 bucket
def fetch_s3_config
return S3Config.new(uri.user, uri.password, nil, "us-east-1") if uri.user && uri.password
s3_source = Gem.configuration[:s3_source] || Gem.configuration["s3_source"]
host = uri.host
raise ConfigurationError.new("no s3_source key exists in .gemrc") unless s3_source
auth = s3_source[host] || s3_source[host.to_sym]
raise ConfigurationError.new("no key for host #{host} in s3_source in .gemrc") unless auth
provider = auth[:provider] || auth["provider"]
case provider
when "env"
id = ENV["AWS_ACCESS_KEY_ID"]
secret = ENV["AWS_SECRET_ACCESS_KEY"]
security_token = ENV["AWS_SESSION_TOKEN"]
when "instance_profile"
credentials = ec2_metadata_credentials_json
id = credentials["AccessKeyId"]
secret = credentials["SecretAccessKey"]
security_token = credentials["Token"]
else
id = auth[:id] || auth["id"]
secret = auth[:secret] || auth["secret"]
security_token = auth[:security_token] || auth["security_token"]
end
View on GitHub (pinned to 86cbb817a3)
Solutions
- Add an entry for the reported host under s3_source in ~/.gemrc
When it happens
Trigger: Thrown at lib/rubygems/s3_uri_signer.rb:118 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/dd929d57c036ff95.
Report an issue: GitHub.