ruby/ruby · error · ProductionError
You are trying to check outdated gems in deployment mode. Ru
Error message
You are trying to check outdated gems in deployment mode. Run `bundle outdated` elsewhere.
If this is a development machine, remove the #{Bundler.default_gemfile} freeze
by running `#{suggested_command}`. What it means
Bundler::CLI::Outdated#check_for_deployment_mode! (lib/bundler/cli/outdated.rb:261) aborts when Bundler.frozen_bundle? is true: checking for outdated gems requires hitting remote sources and building an updated definition, which deployment mode (BUNDLE_DEPLOYMENT=true or BUNDLE_FROZEN=true) forbids. It raises Bundler::ProductionError and, when possible, computes the exact `bundle config unset` command for whichever setting caused the freeze.
Source
Thrown at lib/bundler/cli/outdated.rb:261
end
def cooldown_days_remaining(spec, now = Time.now)
return nil unless spec.respond_to?(:created_at) && spec.created_at
return nil unless spec.respond_to?(:remote) && spec.remote
days = spec.remote.effective_cooldown
return nil if days.nil? || days <= 0
remaining = days - ((now - spec.created_at) / 86_400.0)
remaining > 0 ? remaining.ceil : nil
end
def check_for_deployment_mode!
return unless Bundler.frozen_bundle?
suggested_command = if Bundler.settings.locations("frozen").keys.&([:global, :local]).any?
"bundle config unset frozen"
elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
"bundle config unset deployment"
end
raise ProductionError, "You are trying to check outdated gems in " \
"deployment mode. Run `bundle outdated` elsewhere.\n" \
"\nIf this is a development machine, remove the " \
"#{Bundler.default_gemfile} freeze" \
"\nby running `#{suggested_command}`."
end
def update_present_via_semver_portions(current_spec, active_spec, options)
current_major = current_spec.version.segments.first
active_major = active_spec.version.segments.first
update_present = false
update_present = active_major > current_major if options["filter-major"]
if !update_present && (options["filter-minor"] || options["filter-patch"]) && current_major == active_major
current_minor = get_version_semver_portion_value(current_spec, 1)
active_minor = get_version_semver_portion_value(active_spec, 1)
update_present = active_minor > current_minor if options["filter-minor"]View on GitHub (pinned to 0e5b888e1c)
Solutions
- Run `bundle outdated` on a development machine or CI job without deployment/frozen mode set
- If this is a dev machine, run the command the error prints: `bundle config unset frozen` (or `bundle config unset deployment`)
- Check where it comes from: `bundle config get frozen`, `bundle config get deployment`, and env vars BUNDLE_FROZEN/BUNDLE_DEPLOYMENT
Example fix
# before $ BUNDLE_DEPLOYMENT=true bundle outdated # => You are trying to check outdated gems in deployment mode... # after $ bundle config unset deployment $ bundle outdated
Defensive patterns
Strategy: validation
Validate before calling
if Bundler.frozen_bundle?
warn 'bundle outdated is disabled in deployment/frozen mode'
suggested = Bundler.settings.locations('frozen').keys.intersect?(%i[global local]) ? 'bundle config unset frozen' : 'bundle config unset deployment'
abort "Run `#{suggested}` on a dev machine, or check updates elsewhere"
end
Type guard
def outdated_allowed_here? !Bundler.frozen_bundle? end
Try / catch
begin Bundler::CLI::Outdated.new(options, gems).run rescue Bundler::ProductionError => e warn e.message # includes the exact config unset command exit 1 end
Prevention
- Run update checks in CI with BUNDLE_FROZEN/BUNDLE_DEPLOYMENT unset
- Never exec bundle outdated inside deploy containers
- Periodically audit `bundle config list` for stale deployment/frozen settings
When it happens
Trigger: Running `bundle outdated` on a production host or in a deploy container where BUNDLE_DEPLOYMENT/BUNDLE_FROZEN is set; or on a dev machine where `bundle config set deployment true` was left behind.
Common situations: SSH-ing into a server to check for available updates; Docker images built with BUNDLE_FROZEN=true where operators exec bundle outdated; shared CI runners with global frozen config.
Related errors
- Your lockfile needs to be updated, but it can't be because f
- The #{flag} requires a lockfile. Please make sure you have c
- Frozen mode is set, but there's no lockfile
- can't be updated because frozen mode is set
- Could not find gem '#{gem_name}'.
AI-assisted analysis of ruby/ruby@0e5b888e1c (2026-08-21).
Data as JSON: /api/errors/6b6c4ee29a75e439.
Report an issue: GitHub.