ruby/rubygems · error · SecurityError
The gem #{installer.gem} can't be installed because the secu
Error message
The gem #{installer.gem} can't be installed because the security policy didn't allow it, with the message: #{e.message} What it means
Error "The gem #{installer.gem} can't be installed because the security policy didn't allow it, with the message: #{e.message}" thrown in ruby/rubygems.
Source
Thrown at lib/bundler/source/rubygems.rb:194
index
end
end
def download(spec, options = {})
if (spec.default_gem? && !cached_built_in_gem(spec, local: options[:local])) || (installed?(spec) && !options[:force])
return true
end
installer = rubygems_gem_installer(spec, options)
if spec.remote
s = begin
installer.spec
rescue Gem::Package::FormatError
Bundler.rm_rf(installer.gem)
raise
rescue Gem::Security::Exception => e
raise SecurityError,
"The gem #{installer.gem} can't be installed because " \
"the security policy didn't allow it, with the message: #{e.message}"
end
spec.__swap__(s)
end
spec
end
def install(spec, options = {})
if (spec.default_gem? && !cached_built_in_gem(spec, local: options[:local])) || (installed?(spec) && !options[:force])
print_using_message "Using #{version_message(spec, options[:previous_spec])}"
return nil # no post-install message
end
return if Bundler.settings[:no_install]
View on GitHub (pinned to 86cbb817a3)
When it happens
Trigger: Thrown at lib/bundler/source/rubygems.rb:194 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/f4638086428f0e75.
Report an issue: GitHub.