ruby/rubygems · error · Bundler::DirectoryRemovalError

36

36

Error message

Could not delete previous installation of `#{dir}`

What it means

Error "Could not delete previous installation of `#{dir}`" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/rubygems_gem_installer.rb:234

    end

    def strict_rm_rf(dir)
      return unless File.exist?(dir)
      return if Dir.empty?(dir)

      parent = File.dirname(dir)
      parent_st = File.stat(parent)

      if parent_st.world_writable? && !parent_st.sticky?
        raise InsecureInstallPathError.new(spec.full_name, dir)
      end

      begin
        FileUtils.remove_entry_secure(dir)
      rescue StandardError => e
        raise unless File.exist?(dir)

        raise DirectoryRemovalError.new(e, "Could not delete previous installation of `#{dir}`")
      end
    end
  end
end

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/rubygems_gem_installer.rb:234 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/c6da99b8ffb8b08a. Report an issue: GitHub.