ruby/rubygems · error · GemNotFound

Could not find #{spec.file_name} for installation

Error message

Could not find #{spec.file_name} for installation

What it means

Error "Could not find #{spec.file_name} for installation" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/source/rubygems.rb:596

          Bundler.user_cache.join("gems", cache_slug)
        end
      end

      def extension_cache_slug(spec)
        return unless remote = spec.remote
        remote.cache_slug
      end

      # We are using a mutex to read and write from/to the hash.
      # The reason this double synchronization was added is for performance
      # and to lock the mutex for the shortest possible amount of time. Otherwise,
      # all threads are fighting over this mutex and when it gets acquired it gets locked
      # until a thread finishes downloading a gem, leaving the other threads waiting
      # doing nothing.
      def rubygems_gem_installer(spec, options)
        @gem_installers_mutex.synchronize { @gem_installers[spec.name] } || begin
          path = fetch_gem_if_possible(spec, options[:previous_spec])
          raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path

          REQUIRE_MUTEX.synchronize { require_relative "../rubygems_gem_installer" }

          installer = Bundler::RubyGemsGemInstaller.at(
            path,
            security_policy: Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]],
            install_dir: rubygems_dir.to_s,
            bin_dir: Bundler.system_bindir.to_s,
            ignore_dependencies: true,
            wrappers: true,
            env_shebang: true,
            build_args: options[:build_args],
            bundler_extension_cache_path: extension_cache_path(spec),
            build_extension: Bundler.settings[:no_build_extension] ? false : nil,
            install_plugin: Bundler.settings[:no_install_plugin] ? false : nil
          )
          @gem_installers_mutex.synchronize { @gem_installers[spec.name] ||= installer }
        end

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/source/rubygems.rb:596 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/bd2aad06acd74104. Report an issue: GitHub.