{"record":{"id":"0ef896b110812fcd","repo":"ruby/rubygems","slug":"can-t-be-updated-because-frozen-mode-is-set-if-th","errorCode":null,"errorMessage":"can't be updated because frozen mode is set\n\nIf this is a development machine, remove the #{SharedHelpers.relative_lockfile_path} freeze by running `#{suggested_command}`.","messagePattern":"can't be updated because frozen mode is set\n\nIf this is a development machine, remove the #(.+?) freeze by running `#(.+?)`\\.","errorType":"exception","errorClass":"ProductionError","httpStatus":null,"severity":"error","filePath":"lib/bundler/definition.rb","lineNumber":497,"sourceCode":"    end\n\n    def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)\n      return unless Bundler.frozen_bundle?\n\n      raise ProductionError, \"Frozen mode is set, but there's no lockfile\" unless lockfile_exists?\n\n      msg = lockfile_changes_summary(\"frozen mode is set\")\n      return unless msg\n\n      unless explicit_flag\n        suggested_command = unless Bundler.settings.locations(\"frozen\").keys.include?(:env)\n          \"bundle config set frozen false\"\n        end\n        msg << \"\\n\\nIf this is a development machine, remove the #{SharedHelpers.relative_lockfile_path} \" \\\n               \"freeze by running `#{suggested_command}`.\" if suggested_command\n      end\n\n      raise ProductionError, msg\n    end\n\n    def validate_runtime!\n      validate_ruby!\n      validate_platforms!\n    end\n\n    def validate_ruby!\n      return unless ruby_version\n\n      if diff = ruby_version.diff(Bundler::RubyVersion.system)\n        problem, expected, actual = diff\n\n        msg = case problem\n              when :engine\n                \"Your Ruby engine is #{actual}, but your Gemfile specified #{expected}\"\n              when :version\n                \"Your Ruby version is #{actual}, but your Gemfile specified #{expected}\"","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/bundler/definition.rb#L479-L515","documentation":"The companion frozen check in ensure_equivalent_gemfile_and_lockfile: a lockfile exists but lockfile_changes_summary reports drift between Gemfile and Gemfile.lock, so bundler raises ProductionError with the diff and, when the frozen setting came from local config rather than the environment, appends how to lift the freeze (lib/bundler/definition.rb:497). Under frozen mode the Gemfile is the contract and the lockfile must already satisfy it; this is bundler's equivalent of npm ci refusing an out-of-sync lockfile. It fires during install, Bundler.setup and inject.","triggerScenarios":"`bundle install` with BUNDLE_FROZEN=true after adding or changing a dependency in the Gemfile without re-locking; `bundle exec` or Bundler.setup under frozen with a stale lockfile; a PR edited the Gemfile but the deploy uses an old Gemfile.lock because only one of the two files was committed.","commonSituations":"Deploy pipelines with frozen enabled; `bundle config set frozen true` left over on a dev machine so every Gemfile edit fails the next install; BUNDLE_FROZEN baked into a base Docker image.","solutions":["Regenerate the lockfile where writes are allowed: `bundle install`, commit Gemfile.lock, then retry the frozen environment","If this machine may lock, unfreeze: `bundle config set frozen false` or unset BUNDLE_FROZEN","Read the diff in the error, or run `bundle lock --check`, to see exactly which dependencies drifted","Add `bundle lock --check` as a PR check so drift fails before deploy"],"exampleFix":"# before\n# Gemfile: gem \"sidekiq\", \"~> 7.0\" changed to \"~> 7.3\" without re-locking\n$ BUNDLE_FROZEN=true bundle install\n# => can't be updated because frozen mode is set\n\n# after\n$ bundle install                      # dev machine re-locks\n$ git commit -am \"bump sidekiq and lockfile\"\n$ BUNDLE_FROZEN=true bundle install   # succeeds","handlingStrategy":"validation","validationCode":"# pre-deploy gate\nbundle lock --check || {\n  echo \"Gemfile and Gemfile.lock out of sync under frozen mode\" >&2\n  exit 1\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit Gemfile and Gemfile.lock changes together","Keep frozen scoped to deploy and CI","Fail PRs with bundle lock --check instead of discovering drift at deploy time"],"tags":["bundler","frozen","lockfile","gemfile","deployment"],"backgroundTag":"lockfile-out-of-sync","analyzedSha":"86cbb817a38ce8477b181c17467a703ded3f2be8","analyzedAt":"2026-08-23T06:27:48.159Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}