buresdv / Cork

A fast GUI for Homebrew written in SwiftUI
https://corkmac.app
2.33k stars 131 forks source link

Package Cellar prevented loading #374

Closed megabubbletea closed 3 months ago

megabubbletea commented 3 months ago

What were you trying to do?

When trying to open Cork I get this error message pop-up.

What was the problem?

Error message on load: Package Cellar prevented loading

SCR-20240807-oggc

Restarting Cork will show the error message again.

Error logs

No response

App Version

1.4.4.1

App Acquisition

Bought

Final checklist

buresdv commented 3 months ago

Thanks for the report. This shouldn't happen, as this error is supposed to show only for broken packages and not the entire Cellar folder 🤔

Could you please share your Cork logs? You can follow this tutorial

megabubbletea commented 3 months ago

No problem.

Here are the logs:

default 19:36:46.748904+0900    Cork    Scheduled event fired at <private>
default 19:36:46.806411+0900    Cork    Cached downloads contents: <private>
error   19:36:46.810161+0900    Cork    Could not get proxy host
error   19:36:46.823857+0900    Cork    Couldn't find homebrew/core in local taps
error   19:36:46.823898+0900    Cork    Couldn't find homebrew/cask in local taps
error   19:36:47.745261+0900    Cork    Failed while accessing folder: Error Domain=Cork.PackageLoadingError Code=1
default 19:36:48.100513+0900    Cork    Will attempt to place package name
buresdv commented 3 months ago

That error is pretty generic, would you be open to testing a version of the app that would have more detailed logging?

megabubbletea commented 3 months ago

Sure, I can give it a go 👍

buresdv commented 3 months ago

Alright, I'll prepare it and get back to you 👍

buresdv commented 3 months ago

@megabubbletea can you try this one? It should show a more detailed reason for the failure i nthe alert Cork.zip

megabubbletea commented 3 months ago

Thanks @buresdv I opened it and to my surprise no error message popped up! I just opened it directly from Downloads folder instead of replacing it in Applications.

Checked the logs and seems to be the same:

default 19:23:35.392704+0900    Cork    Cached downloads contents: <private>
error   19:23:35.404342+0900    Cork    Could not get proxy host
error   19:23:35.408998+0900    Cork    Couldn't find homebrew/core in local taps
error   19:23:35.409044+0900    Cork    Couldn't find homebrew/cask in local taps
error   19:23:35.516267+0900    Cork    There appears to be no install receipt for package <private>
default 19:23:36.407305+0900    Cork    Will attempt to place package name
megabubbletea commented 3 months ago

Just tested by replacing the one you sent with the installed version in Applications folder. No error message pop-up on load.

buresdv commented 3 months ago

That's great. There was one case that I changed from an explicit error to a silent failure. It means one of your packages doesn't have an install receipt (meaning it doesn't have any metadata for whatever reason), so this turned out to be a Homebrew error and not related to Cork at all :)

So if it works properly now, do you agree that we can close this issue?

megabubbletea commented 3 months ago

Yep. Thanks! 👍

jpmhouston commented 3 months ago

It looks similar to https://github.com/buresdv/Cork/issues/374 but there is a secondary text on the alert I'm seeing: "Couldn't prepare installation info for reading: %@".

And after dismissing the alert (with the Reveal button) the Cork window says I have 0 Formulae installed (slightly inaccurate, I have 490).

So 2 things I guess: why the alert, the missing part of the secondary message in the alert.

Logs to the console shows a few seemingly innocuous things until:

Failed to load contents of install receipt for package <private> with error <private>
Failed to decode install receipt for package <private> with error <private>
Failed to load contents of install receipt for package <private> with error <private>
Package URL file:///usr/local/Cellar/python/ has no versions installed
Failed while getting package version for package <private>. Package does not have any version installed.

5 more pairs of "Failed to decode" / "Failed to load", then:

Failed while accessing folder: Error Domain=Cork.PackageLoadingError Code=1

Can I turn on better logging somehow? I haven't really looked at the source code at all, my apologies if there's something super obvious I would see in 10 seconds.

(Should I have posted into this closed bug 374 for it to potentially be reopened, or was I right to start this new bug? And I didn't check all that very well for a duplicate, only searching open issues for "Cellar")

buresdv commented 3 months ago

@jpmhouston

That error can only appear in the following situations:

My first instinct would be that there's a permissions issue. I also have no idea why the alert is showing %@ instead of the error itself, I have never seen that happen to anyone.

I'd recommend:

That will hopefully show the system errors properly.

Can you also please create a new bug report for this and tag me there? It's a similar error, but not quite the same.