{"record":{"id":"f4638086428f0e75","repo":"ruby/rubygems","slug":"the-gem-installer-gem-can-t-be-installed-becaus","errorCode":null,"errorMessage":"The gem #{installer.gem} can't be installed because the security policy didn't allow it, with the message: #{e.message}","messagePattern":"The gem #(.+?) can't be installed because the security policy didn't allow it, with the message: #(.+?)","errorType":"exception","errorClass":"SecurityError","httpStatus":null,"severity":"error","filePath":"lib/bundler/source/rubygems.rb","lineNumber":194,"sourceCode":"          index\n        end\n      end\n\n      def download(spec, options = {})\n        if (spec.default_gem? && !cached_built_in_gem(spec, local: options[:local])) || (installed?(spec) && !options[:force])\n          return true\n        end\n\n        installer = rubygems_gem_installer(spec, options)\n\n        if spec.remote\n          s = begin\n            installer.spec\n          rescue Gem::Package::FormatError\n            Bundler.rm_rf(installer.gem)\n            raise\n          rescue Gem::Security::Exception => e\n            raise SecurityError,\n             \"The gem #{installer.gem} can't be installed because \" \\\n             \"the security policy didn't allow it, with the message: #{e.message}\"\n          end\n\n          spec.__swap__(s)\n        end\n\n        spec\n      end\n\n      def install(spec, options = {})\n        if (spec.default_gem? && !cached_built_in_gem(spec, local: options[:local])) || (installed?(spec) && !options[:force])\n          print_using_message \"Using #{version_message(spec, options[:previous_spec])}\"\n          return nil # no post-install message\n        end\n\n        return if Bundler.settings[:no_install]\n","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/bundler/source/rubygems.rb#L176-L212","documentation":"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.","triggerScenarios":"Thrown at lib/bundler/source/rubygems.rb:194 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}