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

Better error messages for "invariant violated: multiple results when describing installed package" #1408

Closed
akurilin opened this issue Nov 23, 2015 · 12 comments

Comments

@akurilin
Copy link

When running stack install below with a custom snapshot, I get the error that I pasted below. It'd be great if the error was more explicit about what exactly went wrong, and perhaps suggestions as far as how to move forward:

$ stack install fr                                                                                                                                                                                                          
yesod-persistent-1.4.0.3: configure
yesod-persistent-1.4.0.3: build
kan-extensions-4.2.3: configure
kan-extensions-4.2.3: build
yesod-persistent-1.4.0.3: copy/register
yesod-form-1.4.4.1: configure
yesod-form-1.4.4.1: build
kan-extensions-4.2.3: copy/register
lens-4.12.3: configure
lens-4.12.3: build
pointed-4.2.0.2: configure
pointed-4.2.0.2: build
pointed-4.2.0.2: copy/register
vector-instances-3.3.1: configure
vector-instances-3.3.1: build
vector-instances-3.3.1: copy/register
mono-traversable-0.9.3: configure
mono-traversable-0.9.3: build
yesod-form-1.4.4.1: copy/register
lens-4.12.3: copy/register
mono-traversable-0.9.3: copy/register
Progress: 7/18singleBuild: invariant violated: multiple results when describing installed package

The code that throws this is here: https://github.com/commercialhaskell/stack/blob/master/src/Stack/Build/Execute.hs#L1110

Also, any advice on how to move past this?

@borsboom
Copy link
Contributor

The "invariant violated" part of that messages means Stack hit a condition that it didn't expect should ever happen and doesn't know how to deal with. In other words: this is a crashing bug, not a bad error message. The reason this shouldn't happen is that Stack unregisters local packages before rebuilding them, meaning there should only ever be a single version of any package in the local package database, but you've hit a condition where, for some reason, there is more than one.

Would you mind sending me the output of stack exec ghc-pkg dump?

First thing I'd try to get past it is rename your .stack-work out of the way, since the problem is likely due to a strange condition within that directory.

@akurilin
Copy link
Author

@borsboom - happen to have an email I can forward that to? Probably has some internal info in there I shouldn't be sharing.

@borsboom
Copy link
Contributor

Sure, you can send it to manny@fpcomplete.com.

@meteficha
Copy link
Member

Assuming this condition was caused by a misuse of the custom snapshot feature, perhaps the error message could be expanded to include something like: "If you're using custom snapshots, you may have violated one of stack's invariants and may need to wipe your ~/.stack/snapshots cache directory."

@borsboom
Copy link
Contributor

So it looks like there are two versions of yesod-form in your snapshot database: yesod-form-1.4.5 and yesod-form-1.4.4.1 (probably the one just registered). It is possible that you modified your custom snapshot and changed the version number?

@akurilin
Copy link
Author

That's very possible, maybe that's the source of the issue. Up to you folks whether you want to surface the specific error to the user more explicitly.

@hesselink
Copy link
Contributor

We also ran into this, and we're also using custom snapshots. I found that I changed the version of a package in the snapshot without renaming the snapshot. So perhaps a message to that effect would be a good idea.

As for fixing it, for us just re-running the original stack command that caused it fixed the problem.

@mgsloan
Copy link
Contributor

mgsloan commented May 1, 2016

This should be resolved in this experimental branch https://github.com/commercialhaskell/stack/tree/863-extensible-snapshots , as a side effect of the work on #863

@Blaisorblade
Copy link
Collaborator

Replaced old label in-progress with "in progress" (see #1491 (comment)).

@snoyberg
Copy link
Contributor

snoyberg commented Jul 5, 2017

I'd be very interested to hear if the #3249 PR for extensible snapshots addresses this, the fact that we cache the snapshot information by a unique hash of the contents of the file would hopefully fix it.

@chris-martin
Copy link
Contributor

I just ran into this using Stack 1.4.0, for what it's worth.

@mpilgrem
Copy link
Member

I am closing this issue given the passage of time and because the form of the bug report is different in Stack 2.13.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants