{"record":{"id":"f8e366c00bf797c7","repo":"ruby/rubygems","slug":"frozen-mode-is-set-but-there-s-no-lockfile","errorCode":null,"errorMessage":"Frozen mode is set, but there's no lockfile","messagePattern":"Frozen mode is set, but there's no lockfile","errorType":"exception","errorClass":"ProductionError","httpStatus":null,"severity":"error","filePath":"lib/bundler/definition.rb","lineNumber":484,"sourceCode":"            \"Try running bundle update --ruby to resolve this.\"\n        end\n        version\n      end\n    end\n\n    def bundler_version_to_lock\n      @resolved_bundler_version || Bundler.gem_version\n    end\n\n    def to_lock\n      require_relative \"lockfile_generator\"\n      LockfileGenerator.generate(self)\n    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!","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/bundler/definition.rb#L466-L502","documentation":"Under frozen mode (Bundler.frozen_bundle?) Definition#ensure_equivalent_gemfile_and_lockfile first requires that a lockfile exists at all, raising ProductionError when it does not (lib/bundler/definition.rb:484). Frozen and deployment installs are lockfile-driven: bundler installs exactly the versions recorded in Gemfile.lock, so with no lockfile there is nothing to install from and bundler refuses instead of resolving freely. The check runs on the install, Bundler.setup and inject paths.","triggerScenarios":"`bundle install --deployment` or BUNDLE_FROZEN=true in a tree with no Gemfile.lock (fresh clone of a repo that never committed one); a Docker image that COPYies Gemfile but not Gemfile.lock before a frozen install; Bundler.setup under a frozen env in a freshly generated app.","commonSituations":"Gemfile.lock gitignored by a misconfigured template while CI or a PaaS sets frozen or deployment; deploy tooling defaulting to --deployment; a new service bootstrapped without ever generating the lockfile.","solutions":["Generate and commit the lockfile: run `bundle install` on a dev machine, `git add Gemfile.lock`, push, then redeploy","If Gemfile.lock is gitignored, remove it from .gitignore; frozen deploys require the lockfile in version control","If freezing was not intended, turn it off: `bundle config set frozen false`, unset BUNDLE_FROZEN, or drop --deployment","In Dockerfiles, COPY Gemfile.lock together with Gemfile before RUN bundle install"],"exampleFix":"# before\n$ bundle install --deployment\n# => Frozen mode is set, but there's no lockfile\n\n# after\n$ bundle install && git add Gemfile.lock && git commit -m \"add lockfile\" && git push\n$ bundle install --deployment","handlingStrategy":"validation","validationCode":"frozen = %w[1 true].include?(ENV[\"BUNDLE_FROZEN\"]) || Bundler.settings[\"frozen\"]\nif frozen && !Bundler.default_lockfile.exist?\n  abort \"frozen install needs a committed Gemfile.lock\"\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always commit Gemfile.lock for applications","Never gitignore Gemfile.lock in deployable projects","Boot new apps with bundle install before enabling deployment mode"],"tags":["bundler","frozen","lockfile","deployment","gitignore"],"backgroundTag":"missing-lockfile","analyzedSha":"86cbb817a38ce8477b181c17467a703ded3f2be8","analyzedAt":"2026-08-23T06:27:48.159Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}