Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Stack level too deep #16628

Closed
Pandoks opened this issue Feb 9, 2024 · 14 comments · Fixed by #16635
Closed

Error: Stack level too deep #16628

Pandoks opened this issue Feb 9, 2024 · 14 comments · Fixed by #16635
Assignees
Labels
bug Reproducible Homebrew/brew bug outdated PR was locked due to age

Comments

@Pandoks
Copy link

Pandoks commented Feb 9, 2024

brew gist-logs <formula> link OR brew config AND brew doctor output

Note: brew doctor doesn't say Your system is ready to brew. I got rid of all the errors that normally output from brew doctor except for this.

`brew config`:

HOMEBREW_VERSION: 4.2.7-84-ga925911
ORIGIN: https://github.com/Homebrew/brew
HEAD: a92591108dfab9912182fb63f4fb01788d066b0a
Last commit: 11 hours ago
Core tap JSON: 09 Feb 00:14 UTC
Core cask tap JSON: 08 Feb 23:46 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: nvim
HOMEBREW_MAKE_JOBS: 10
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.43.0 => /opt/homebrew/bin/git
Curl: 8.4.0 => /usr/bin/curl
macOS: 14.2.1-arm64
CLT: 15.1.0.0.1.1700200546
Xcode: 15.2
Rosetta 2: false

brew doctor:

Error: stack level too deep
Please report this issue:
  https://docs.brew.sh/Troubleshooting
Warning: Removed Sorbet lines from backtrace!
Rerun with `--verbose` to see the original backtrace
/opt/homebrew/Library/Homebrew/extend/blank.rb:139:in `blank?'
/opt/homebrew/Library/Homebrew/extend/blank.rb:147:in `present?'
/opt/homebrew/Library/Homebrew/extend/blank.rb:40:in `presence'
/opt/homebrew/Library/Homebrew/formulary.rb:918:in `tap_formula_name_type'
/opt/homebrew/Library/Homebrew/formulary.rb:924:in `tap_formula_name_type'
/opt/homebrew/Library/Homebrew/formulary.rb:924:in `tap_formula_name_type'

... repeating about 4500 times ...

/opt/homebrew/Library/Homebrew/formulary.rb:924:in `tap_formula_name_type'
/opt/homebrew/Library/Homebrew/formulary.rb:924:in `tap_formula_name_type'
/opt/homebrew/Library/Homebrew/formulary.rb:924:in `tap_formula_name_type'
/opt/homebrew/Library/Homebrew/formulary.rb:936:in `tap_loader_for'
/opt/homebrew/Library/Homebrew/formulary.rb:958:in `loader_for'
/opt/homebrew/Library/Homebrew/formulary.rb:744:in `factory'
/opt/homebrew/Library/Homebrew/formulary.rb:836:in `from_keg'
/opt/homebrew/Library/Homebrew/formulary.rb:787:in `from_rack'
/opt/homebrew/Library/Homebrew/formula.rb:1973:in `block in installed'
/opt/homebrew/Library/Homebrew/formula.rb:1972:in `each'
/opt/homebrew/Library/Homebrew/formula.rb:1972:in `flat_map'
/opt/homebrew/Library/Homebrew/formula.rb:1972:in `installed'
/opt/homebrew/Library/Homebrew/diagnostic.rb:637:in `check_deprecated_disabled'
/opt/homebrew/Library/Homebrew/cmd/doctor.rb:61:in `block in doctor'
/opt/homebrew/Library/Homebrew/cmd/doctor.rb:54:in `each'
/opt/homebrew/Library/Homebrew/cmd/doctor.rb:54:in `doctor'
/opt/homebrew/Library/Homebrew/brew.rb:86:in `<main>'


### Verification

- [X] My "`brew doctor` output" says `Your system is ready to brew.` and am still able to reproduce my issue.
- [X] I ran `brew update` and am still able to reproduce my issue.
- [X] I have resolved all warnings from `brew doctor` and that did not fix my problem.
- [X] I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

### What were you trying to do (and why)?

Commands that fail and produce the same error as `brew doctor` (above):
- `brew autoremove`
- `brew cleanup`
- `brew doctor`
- `brew leaves`
- `brew missing`
- `brew outdated`
- `brew upgrade`
- `brew autoremove`

I'm sure I'm missing some, but you get the point. A lot of the commands just don't work.

### What happened (include all command output)?

The same output as `brew doctor shows up except for the last few lines. Here is an example with `autoremove`
`brew autoremove`:

Error: stack level too deep
Please report this issue:
https://docs.brew.sh/Troubleshooting
Warning: Removed Sorbet lines from backtrace!
Rerun with --verbose to see the original backtrace
/opt/homebrew/Library/Homebrew/extend/blank.rb:139:in blank?' /opt/homebrew/Library/Homebrew/extend/blank.rb:147:in present?'
/opt/homebrew/Library/Homebrew/extend/blank.rb:40:in presence' /opt/homebrew/Library/Homebrew/formulary.rb:918:in tap_formula_name_type'
/opt/homebrew/Library/Homebrew/formulary.rb:924:in tap_formula_name_type' /opt/homebrew/Library/Homebrew/formulary.rb:924:in tap_formula_name_type'

... repeating about 4500 times ...

/opt/homebrew/Library/Homebrew/formulary.rb:924:in tap_formula_name_type' /opt/homebrew/Library/Homebrew/formulary.rb:924:in tap_formula_name_type'
/opt/homebrew/Library/Homebrew/formulary.rb:924:in tap_formula_name_type' /opt/homebrew/Library/Homebrew/formulary.rb:936:in tap_loader_for'
/opt/homebrew/Library/Homebrew/formulary.rb:958:in loader_for' /opt/homebrew/Library/Homebrew/formulary.rb:744:in factory'
/opt/homebrew/Library/Homebrew/formulary.rb:836:in from_keg' /opt/homebrew/Library/Homebrew/formulary.rb:787:in from_rack'
/opt/homebrew/Library/Homebrew/formula.rb:1973:in block in installed' /opt/homebrew/Library/Homebrew/formula.rb:1972:in each'
/opt/homebrew/Library/Homebrew/formula.rb:1972:in flat_map' /opt/homebrew/Library/Homebrew/formula.rb:1972:in installed'
/opt/homebrew/Library/Homebrew/cleanup.rb:651:in autoremove' /opt/homebrew/Library/Homebrew/cmd/autoremove.rb:25:in autoremove'
/opt/homebrew/Library/Homebrew/brew.rb:86:in `

'


### What did you expect to happen?

Run normally

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

```shell
- `brew autoremove`
- `brew cleanup`
- `brew doctor`
- `brew leaves`
- `brew missing`
- `brew outdated`
- `brew upgrade`
- `brew autoremove`
@Pandoks Pandoks added the bug Reproducible Homebrew/brew bug label Feb 9, 2024
@SMillerDev
Copy link
Member

I think this should be in @Homebrew/brew . If someone could move it... please?

@MikeMcQuaid MikeMcQuaid transferred this issue from Homebrew/homebrew-core Feb 9, 2024
@Pandoks
Copy link
Author

Pandoks commented Feb 9, 2024

A little background, that might help with debugging:
mitmproxy used to be a formulae and then it got converted into a cask.
I had to manually delete mitmproxy by going into /opts/homebrew/Cellar and rm -rf mitmproxy.

I thought that this would fix it as it was something that brew doctor told me, but it did not.

@Pandoks
Copy link
Author

Pandoks commented Feb 9, 2024

Resolved. I had a bad brew tap (humansignal/tap). Once I removed it, everything works again.

@Pandoks Pandoks closed this as completed Feb 9, 2024
@YYYasin19
Copy link

Hi,
how did you find out which tap was the broken one?

@Pandoks
Copy link
Author

Pandoks commented Feb 9, 2024

Hi, how did you find out which tap was the broken one?

Guess and check. I just untapped a tap and then ran brew doctor. If there was still an error, I'd untap the next tap until it worked. I then tapped the taps back one by one until there was an error and found the culprit.

@YYYasin19
Copy link

I see, just removed them all and it now works. I didn't have humansignal/tap though, so the error seems to be across different taps.

@dduugg dduugg reopened this Feb 9, 2024
@dduugg
Copy link
Member

dduugg commented Feb 9, 2024

@reitermarkus was tap_formula_name_type introduced in https://github.com/Homebrew/brew/pull/16595/files#diff-839796286e3c16329d41ed9ee082b9c7fe43253d16d928d807ca9961e69574adR905 ?

Did it introduce a potential infinite loop?

@YYYasin19
Copy link

Sorry!
I was wrong, it's humansignal/tap for me too!
i.e. brew tap humansignal/tap && brew doctor will reproduce this

@apainintheneck
Copy link
Contributor

I don't know if we can really avoid this type of error when there are problems with a third-party tap but we should at the very least improve the messaging a bit. Also, I'm not sure why this would pop up after that last change.

@reitermarkus
Copy link
Member

@reitermarkus was tap_formula_name_type introduced in https://github.com/Homebrew/brew/pull/16595/files#diff-839796286e3c16329d41ed9ee082b9c7fe43253d16d928d807ca9961e69574adR905 ?

tap_formula_name_type was not introduced, but refactored. The recursion was present before though, but tap_formula_name_type is now used in more places I think.

@reitermarkus
Copy link
Member

Okay, so it seems the tap migrations.json in humansignal/tap points to itself:

{
  "label-studio": "humansignal/tap"
}

@apainintheneck
Copy link
Contributor

Okay, so it seems the tap migrations.json in humansignal/tap points to itself:

{
  "label-studio": "humansignal/tap"
}

🤦 That explains it. Thanks for the fix in #16635 to prevent that in the future. I wonder if we should be auditing taps a bit when they get added to make these sorts of problems more visible too.

@MikeMcQuaid
Copy link
Member

@dduugg @reitermarkus @apainintheneck is there a PR we can revert to resolve this?

@MikeMcQuaid
Copy link
Member

Ignore me, sorry: weird GitHub caching here because that issue wasn't showing up as closed with repeated refreshes 🤷

@github-actions github-actions bot added the outdated PR was locked due to age label Mar 14, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/brew bug outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants