Unclear error message when you have insufficient rights to a snap.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
New
|
Undecided
|
Unassigned |
Bug Description
tl;dr If you have insufficient rights to a snap then snapcraft prints an unhelpful error message (for commands that interact with the snap store).
I went to push a snap (let's call it "proj-snap") for a project I work on and the command failed:
$ snapcraft push proj-snap_
Snap 'proj-snap' was not found in '16' series.
That error message left me uncertain as to the problem (did I misspell it or something?) or what to do next. After double-checking, I verified that the snap name was correct. So I ran "snapcraft list-revisions proj-snap" to see what it would tell me, thinking that perhaps "series" in the error message was related to the revision. I got the same error.
At that point I tracked down the source code that matches the error message (SnapNotFoundError) and then the likely place the exception was raised. [1] Then it became mostly clear that snapcraft knows which snaps I have rights to and failed when it couldn't find "proj-snap" in that list. To verify this I ran "snapcraft list-revisions my-snap", where "my-snap" is a snap that I personally registered; it worked without error.
Conclusion: if you don't have sufficient rights to a snap in the store then snapcraft should clearly tell you that (e.g. "Insufficient rights to snap 'proj-snap'"). That would have saved me a bunch of time.
This occurs with other commands as well, e.g. `snapcraft status`. This message definitely needs to be changed.