{"record":{"id":"96f78b0c4377338b","repo":"ruby/rubygems","slug":"no-s3-source-key-exists-in-gemrc","errorCode":null,"errorMessage":"no s3_source key exists in .gemrc","messagePattern":"no s3_source key exists in \\.gemrc","errorType":"exception","errorClass":"Gem::S3URISigner::ConfigurationError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/s3_uri_signer.rb","lineNumber":115,"sourceCode":"    ].join(\"\\n\")\n  end\n\n  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\"]","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/s3_uri_signer.rb#L97-L133","documentation":"Error \"no s3_source key exists in .gemrc\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/s3_uri_signer.rb:115 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add an s3_source section to ~/.gemrc with your S3 host credentials"],"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"}