ruby/rubygems · error · Bundler::LockfileError

20

20

Error message

Your #{@lockfile_path} contains merge conflicts.
Run `git checkout HEAD -- #{@lockfile_path}` first to get a clean lock.

What it means

Error "Your #{@lockfile_path} contains merge conflicts. Run `git checkout HEAD -- #{@lockfile_path}` first to get a clean lock." thrown in ruby/rubygems.

Source

Thrown at lib/bundler/lockfile_parser.rb:114

    end

    def initialize(lockfile, strict: false, lockfile_path: nil)
      @platforms    = []
      @sources      = []
      @metadata_source = Source::Metadata.new
      @dependencies = {}
      @parse_method = nil
      @specs        = {}
      @lockfile_path = lockfile_path || begin
        SharedHelpers.relative_lockfile_path
      rescue GemfileNotFound
        "Gemfile.lock"
      end
      @pos = Position.new(1, 1)
      @strict = strict

      if lockfile.match?(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
        raise LockfileError, "Your #{@lockfile_path} contains merge conflicts.\n" \
          "Run `git checkout HEAD -- #{@lockfile_path}` first to get a clean lock."
      end

      @valid = lockfile.strip.empty? ||
               lockfile.split(/(?:\r?\n)+/).any? {|l| KNOWN_SECTIONS.include?(l) }

      unless @valid
        SharedHelpers.feature_deprecated!(
          "Your #{@lockfile_path} does not appear to be a valid lockfile. " \
          "Run `rm #{@lockfile_path}` and then `bundle install` to generate a new lockfile. " \
          "This will raise a LockfileError in a future version of Bundler."
        )
      end

      lockfile.split(/((?:\r?\n)+)/) do |line|
        # split alternates between the line and the following whitespace
        next @pos.advance!(line) if line.match?(/^\s*$/)

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/lockfile_parser.rb:114 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/ef2ad178e8414c6a. Report an issue: GitHub.