ruby/rubygems · error

Cannot pristine #{gem_name}. Gem is sourced from local path.

Error message

Cannot pristine #{gem_name}. Gem is sourced from local path.

What it means

Error "Cannot pristine #{gem_name}. Gem is sourced from local path." thrown in ruby/rubygems.

Source

Thrown at lib/bundler/cli/pristine.rb:49

            FileUtils.rm_rf spec.full_gem_path
          when Source::Git
            if source.local?
              Bundler.ui.warn("Cannot pristine #{gem_name}. Gem is locally overridden.")
              next
            end

            source.remote!
            if extension_cache_path = source.extension_cache_path(spec)
              FileUtils.rm_rf extension_cache_path
            end
            FileUtils.rm_rf spec.extension_dir
            FileUtils.rm_rf spec.full_gem_path

            next if git_sources.include?(source)
            git_sources << source
          else
            Bundler.ui.warn("Cannot pristine #{gem_name}. Gem is sourced from local path.")
            next
          end

          true
        end.map(&:name)

        jobs = Bundler.settings.installation_parallelization
        pristine_count = definition.specs.count - installed_specs.count
        # allow a pristining a single gem to skip the parallel worker
        jobs = [jobs, pristine_count].min
        ParallelInstaller.call(installer, definition.specs, jobs, false, true, skip: installed_specs)
      end
    end
  end
end

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Pristine does not apply to path gems; cd into the gem's path and reinstall/rebuild it there

When it happens

Trigger: Thrown at lib/bundler/cli/pristine.rb:49 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/2f7b8a6dcebba3a2. Report an issue: GitHub.