← Back to issue list

Handle macaroon-authorization-required error response

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1930592
Type
issue
State
open
Author
~nataliabidart
Labels
craft-339
Created
Updated
Closed

Current evaluation

snapcraft whoami shows a generic 'Store Error: whoami failed.' instead of prompting re-authentication when credentials are missing/expired (401 macaroon-authorization-required). Open since 2021, zero comments, no maintainer activity or labels.

Suggested action: needs triage

Reason: The issue has 0 comments, no labels, no assignee, and no maintainer response in ~5 years (last activity 1887 days ago), so it has never been triaged. It is a genuine bug with a full debug traceback (401 'macaroon-authorization-required' from the dashboard whoami endpoint), not a support question, and the underlying UX problem (generic error instead of re-auth prompt) is likely still relevant in the current craft-store-based implementation, so it should not be closed as stale without verification. Confidence is moderate because repo code inspection was unavailable (pinned SHA errors), so I could not confirm whether the 401 handling was already improved in the current snapcraft/store code.

Impact: 35 Quick Win: 21.0 Staleness: 95 Complexity: 40 Confidence: 65 Support Request: 10

Issue body

When issuing snapcraft whoami on a system without credentials or with expired ones, as a user I get an error instead of a prompt to re-authenticate: nessita@dali:~$ snapcraft whoami Store Error: whoami failed. nessita@dali:~$ export SNAPCRAFT_ENABLE_DEVELOPER_DEBUG=1 nessita@dali:~$ snapcraft whoami Starting snapcraft 4.8 from /snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/cli. configure_requests_ca: using '/etc/ssl/certs/ca-certificates.crt' for certificate verification Candid forced: False. Candid crendendials: False. Calling https://dashboard.snapcraft.io/api/v2/tokens/whoami with params None and headers {'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': None, 'User-Agent': 'snapcraft/4.8 Ubuntu/20.04 (amd64)'} Store error response: {'_content': b'{"error-list": [{"message": "The request is missing an Authorization header field containing a valid macaroon", "code": "macaroon-authorization-required", "extra": {"realm": "Developer Portal"}}]}', '_content_consumed': True, '_next': None, 'status_code': 401, 'headers': {'Date': 'Wed, 02 Jun 2021 13:32:10 GMT', 'Server': 'gunicorn/19.7.0', 'Content-Type': 'application/json', 'WWW-Authenticate': 'Macaroon realm="Developer Portal"', 'Expires': 'Wed, 02 Jun 2021 13:32:10 GMT', 'Cache-Control': 'max-age=0, no-cache, no-store, must-revalidate', 'X-View-Name': 'api-tokens-whoami', 'Vary': 'Accept-Language,Cookie', 'Content-Language': 'en', 'Content-Length': '196', 'X-VCS-Revision': 'b143b7791b', 'X-Request-Id': 'YLeIWn8AAQEAADi5H34AAAPd1', 'X-Cache': 'MISS from juju-08138e-prod-scasnap-xenial-4', 'X-Cache-Lookup': 'MISS from juju-08138e-prod-scasnap-xenial-4:3128', 'Via': '1.1 juju-08138e-prod-scasnap-xenial-4 (squid/3.5.12)', 'Strict-Transport-Security': 'max-age=2592000', 'Keep-Alive': 'timeout=5, max=100', 'Connection': 'Keep-Alive'}, 'raw': <urllib3.response.HTTPResponse object at 0x7f8439ce8f60>, 'url': 'https://dashboard.snapcraft.io/api/v2/tokens/whoami', 'encoding': 'utf-8', 'history': [], 'reason': 'Unauthorized', 'cookies': <RequestsCookieJar[]>, 'elapsed': datetime.timedelta(0, 0, 932062), 'request': <PreparedRequest [GET]>, 'connection': <requests.adapters.HTTPAdapter object at 0x7f8439ce82b0>} Sorry, an error occurred in Snapcraft: Store Error: whoami failed. Traceback (most recent call last): File "/snap/snapcraft/6512/bin/snapcraft", line 33, in <module> sys.exit(load_entry_point('snapcraft==4.8', 'console_scripts', 'snapcraft')()) File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/cli/store.py", line 840, in whoami account = StoreClientCLI().whoami().account File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/storeapi/_store_client.py", line 97, in whoami return self.dashboard.whoami() File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/storeapi/_dashboard_api.py", line 367, in whoami raise errors.GeneralStoreError(message="whoami failed.", response=response) snapcraft.storeapi.errors.GeneralStoreError: Store Error: whoami failed. You can find the traceback in file '/tmp/tmpsgqh5y34/trace.txt'.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 35
Quick Win: 21.0
Staleness: 95
Complexity: 40
Confidence: 65
Support Request: 10
needs triage snapcraft whoami shows a generic 'Store Error: whoami failed.' instead of prompting re-authentication when credentials are missing/expired (401 macaroon-authorization-required). Open since 2021, zero comments, no maintainer activity or labels.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 35
Confidence: 85
Support Request: 10
needs triage snapcraft whoami fails with a generic error instead of prompting re-authentication when credentials are missing or expired. Open for over 5 years with no maintainer response or triage.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 25
Confidence: 85
Support Request: 15
close stale Unhandled macaroon-authorization-required API error causes generic failure instead of re-auth prompt. Issue is over 5 years old with no maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 20
Confidence: 85
Support Request: 10
close stale Snapcraft fails with a generic error when credentials are missing or expired instead of prompting for re-authentication. Untriaged, inactive for over 5 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 20
Confidence: 85
Support Request: 10
close stale Reports a generic Store Error instead of prompting re-authentication when macaroon credentials are missing or expired. Unassessed for over five years.

Update history

No update history recorded yet.

Related work

  • Related To: craft-store#97 (confidence 70%)

    craft-store#97 reports the same class of problem: confusing macaroon error on expired credentials instead of a re-login prompt; triaged there with Jira CRAFT-3385 but still open.

Related issues

Issue Project State Summary Similarity
#1834469 error messaging for invalid macaroon could be improved snapcraft (launchpad) open Snapcraft shows a confusing 'missing a valid macaroon' error when the store macaroon expires; suggests guiding users to snapcraft login. 7 years old, no labels, no comments, no maintainer response. Related craft-store#97 tracks the same problem class.
78%
#97 Confusing error message on expired macaroon craft-store open craft-store shows a confusing 'macaroon-permission-required' error when store credentials expire instead of telling users to re-login. Triaged by a maintainer with a Jira ticket (CRAFT-3385), but no code work; last activity ~11 months ago.
74%
#1856502 Obscure error message from snapcraft release when not logged in correctly snapcraft (launchpad) open snapcraft release prints an obscure 401 macaroon error when not logged in; user suggests a friendlier message pointing to 'snapcraft login'. No labels, no comments, ~6.5 years inactive. Same problem class tracked in craft-store#97 and LP 1834469.
74%
#1674124 trying to push with the wrong macaroon return non user-friendly error snapcraft (launchpad) open Snapcraft push with a macaroon attenuated to a different snap returns a raw 403 JSON blob instead of a user-friendly error. Opened by maintainer elopio ~9.4 years ago, zero comments, no labels beyond bitesize/store/ui, no recorded fix.
72%
#1745264 error message for expired macaroon is not helpful snapcraft (launchpad) closed Closed without discussion or a formal fix. The report highlighted an unhelpful 401 error for an expired Travis CI macaroon during snap uploads, likely resolved by updating credentials or abandoned.
72%
#1843404 snapcraft export-login doesn't provide meaningful error messages when an argument is wrong snapcraft (launchpad) open snapcraft export-login returns a generic 'Authentication error: Failed to get macaroon' instead of a meaningful message when an argument (e.g. snap name) is wrong. Unlabelled, zero comments, no maintainer interaction for ~7 years.
70%