ruby/rubygems · error · Bundler::GitError

11

11

Error message

Cannot use local override for #{name} at #{path} because :branch is not specified in Gemfile. Specify a branch or run `bundle config unset local.#{override_for(original_path)}` to remove the local override

What it means

Error "Cannot use local override for #{name} at #{path} because :branch is not specified in Gemfile. Specify a branch or run `bundle config unset local.#{override_for(original_path)}` to remove the local override" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/source/git.rb:157

        "#{base_name}-#{shortref_for_path(revision)}"
      end

      def unlock!
        git_proxy.revision = nil
        options["revision"] = nil

        @unlocked = true
      end

      def local_override!(path)
        return false if local?

        original_path = path
        path = Pathname.new(path)
        path = path.expand_path(Bundler.root) unless path.relative?

        unless branch || Bundler.settings[:disable_local_branch_check]
          raise GitError, "Cannot use local override for #{name} at #{path} because " \
            ":branch is not specified in Gemfile. Specify a branch or run " \
            "`bundle config unset local.#{override_for(original_path)}` to remove the local override"
        end

        unless path.exist?
          raise GitError, "Cannot use local override for #{name} because #{path} " \
            "does not exist. Run `bundle config unset local.#{override_for(original_path)}` to remove the local override"
        end

        @local = true
        set_paths!(path)

        # Create a new git proxy without the cached revision
        # so the Gemfile.lock always picks up the new revision.
        @git_proxy = GitProxy.new(path, uri, options)

        if current_branch != branch && !Bundler.settings[:disable_local_branch_check]
          raise GitError, "Local override for #{name} at #{path} is using branch " \

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/source/git.rb:157 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/3310cde34ba9d284. Report an issue: GitHub.