{"record":{"id":"22bb44a26ee687f9","repo":"ruby/rubygems","slug":"this-bundle-hasn-t-been-installed-yet-run-bundle","errorCode":null,"errorMessage":"This Bundle hasn't been installed yet. Run `bundle install` to update and install the bundled gems.","messagePattern":"This Bundle hasn't been installed yet\\. Run `bundle install` to update and install the bundled gems\\.","errorType":"exception","errorClass":"GemfileLockNotFound","httpStatus":null,"severity":"error","filePath":"lib/bundler/cli/update.rb","lineNumber":42,"sourceCode":"        if Bundler.settings[:update_requires_all_flag]\n          raise InvalidOption, \"To update everything, pass the `--all` flag.\"\n        end\n        SharedHelpers.feature_deprecated! \"Pass --all to `bundle update` to update everything\"\n      elsif !full_update && options[:all]\n        raise InvalidOption, \"Cannot specify --all along with specific options.\"\n      end\n\n      conservative = options[:conservative]\n\n      unlock = if full_update\n        if conservative\n          { conservative: conservative }\n        else\n          true\n        end\n      else\n        unless Bundler.default_lockfile.exist?\n          raise GemfileLockNotFound, \"This Bundle hasn't been installed yet. \" \\\n            \"Run `bundle install` to update and install the bundled gems.\"\n        end\n        explicit_gems = gems.dup\n\n        if groups.any?\n          deps = Bundler.definition.dependencies.select {|d| (d.groups & groups).any? }\n          gems.concat(deps.map(&:name))\n        end\n\n        {\n          gems: gems,\n          sources: sources,\n          ruby: options[:ruby],\n          conservative: conservative,\n          bundler: update_bundler,\n        }\n      end\n","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/bundler/cli/update.rb#L24-L60","documentation":"Raised as Bundler::GemfileLockNotFound by targeted `bundle update` invocations (gem names, --group, --source, --ruby, --bundler) when Bundler.default_lockfile does not exist. A targeted update patches an existing Gemfile.lock; with no lockfile there is nothing to unlock, so bundler points at `bundle install` as the command that creates the lockfile (lib/bundler/cli/update.rb:41-44). A full `bundle update` bypasses this branch because it resolves from scratch.","triggerScenarios":"`bundle update rails` or `bundle update --group development` in a project that has a Gemfile but no Gemfile.lock yet; the same after a fresh clone of a repo that never committed the lockfile; a targeted update while BUNDLE_GEMFILE points at a Gemfile whose sibling lockfile is missing.","commonSituations":"Gemfile.lock gitignored by accident so fresh clones and CI have no lockfile; a brand-new project where bundle install was never run; Docker builds that copy Gemfile but not Gemfile.lock; running the command from the wrong directory.","solutions":["Run `bundle install` first to create Gemfile.lock, then repeat `bundle update <gem>`","If Gemfile.lock is gitignored, remove it from .gitignore and commit the lockfile so clones and CI start with one","If a full re-resolve is wanted, run `bundle update` with no gem names, which does not require an existing lockfile","Check BUNDLE_GEMFILE and the working directory when the lockfile exists somewhere else"],"exampleFix":"# before (fresh clone, no Gemfile.lock)\nbundle update rails\n# => This Bundle hasn't been installed yet.\n\n# after\nbundle install\nbundle update rails","handlingStrategy":"validation","validationCode":"# Fail fast in scripts before a targeted update\ntest -f Gemfile.lock || { echo \"Gemfile.lock missing: run bundle install first\" >&2; exit 1; }\nbundle update \"$@\"","typeGuard":null,"tryCatchPattern":"begin\n  Bundler::CLI::Update.new(options, %w[rails]).run\nrescue Bundler::GemfileLockNotFound => e\n  warn e.message\n  system(\"bundle\", \"install\") || abort\nend","preventionTips":["Commit Gemfile.lock for applications","Bootstrap scripts must run bundle install before any bundle update","In Dockerfiles COPY Gemfile and Gemfile.lock together"],"tags":["bundler","lockfile","cli","fresh-install"],"backgroundTag":"missing-lockfile","analyzedSha":"86cbb817a38ce8477b181c17467a703ded3f2be8","analyzedAt":"2026-08-23T06:27:48.159Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}