Skip to content

brew upgrade fails when an outdated package is pinned (Error: undefined method 'each' for nil) #20177

@kjoonlee

Description

@kjoonlee

brew doctor output

Your system is ready to brew.

Verification

  • My "brew doctor output" above says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update twice and am still able to reproduce my issue.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

HOMEBREW_VERSION: 4.5.8-87-g4fd7c6f
ORIGIN: https://github.com/Homebrew/brew
HEAD: 4fd7c6fa8d2caedeefe80481404257607bf76692
Last commit: 63 minutes ago
Branch: master
Core tap JSON: 26 Jun 15:54 UTC
Core cask tap JSON: 26 Jun 15:46 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_BAT: set
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.QsQhj00jtK/org.xquartz:0
HOMEBREW_EDITOR: vim
HOMEBREW_INSTALL_BADGE: 💨
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_ENV_HINTS: set
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.4.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.4.4/bin/ruby
CPU: octa-core 64-bit arm_blizzard_avalanche
Clang: 17.0.0 build 1700
Git: 2.50.0 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.5-arm64
CLT: 16.4.0.0.1.1747106510
Xcode: 16.4
Rosetta 2: false

What were you trying to do (and why)?

Was trying to see if I had outdate packages.

(I had qemu 9.2.3 pinned because I couldn’t figure out how to make sound work with qemu 10.0 and higher.)

What happened (include all command output)?

Warning: Not upgrading 1 pinned package:
qemu 10.0.2_2
==> No packages to upgrade
Error: undefined method 'each' for nil
/opt/homebrew/Library/Homebrew/upgrade.rb:96:in 'Homebrew::Upgrade.upgrade_formulae'
/opt/homebrew/Library/Homebrew/cmd/upgrade.rb:258:in 'Homebrew::Cmd::UpgradeCmd#upgrade_outdated_formulae'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12117/lib/types/private/methods/call_validation.rb:282:in 'UnboundMethod#bind_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12117/lib/types/private/methods/call_validation.rb:282:in 'T::Private::Methods::CallValidation.validate_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12117/lib/types/private/methods/_methods.rb:277:in 'block in Homebrew::Cmd::UpgradeCmd#_on_method_added'
/opt/homebrew/Library/Homebrew/cmd/upgrade.rb:140:in 'Homebrew::Cmd::UpgradeCmd#run'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12117/lib/types/private/methods/call_validation.rb:282:in 'UnboundMethod#bind_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12117/lib/types/private/methods/call_validation.rb:282:in 'T::Private::Methods::CallValidation.validate_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12117/lib/types/private/methods/_methods.rb:277:in 'block in Homebrew::Cmd::UpgradeCmd#_on_method_added'
/opt/homebrew/Library/Homebrew/brew.rb:95:in '

'
Please report this issue:
https://docs.brew.sh/Troubleshooting

What did you expect to happen?

brew would print that qemu was pinned, and report that nothing needed to be upgraded.

Step-by-step reproduction instructions (by running brew commands)

wget https://github.com/Homebrew/homebrew-core/raw/4c444ba22896d1a796f723c71763fbf28bc0ae93/Formula/q/qemu.rb
brew install ./qemu.rb
brew pin qemu
brew upgrade --verbose

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions