← Back to issue list

Exception raised when trying to operate on a snap that I don't own nor collaborate with

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1743428
Type
issue
State
open
Author
~nataliabidart
Labels
—
Created
Updated
Closed
—

Current evaluation

403 package_upload responses made snapcraft release fail with a StoreReleaseError formatting KeyError and raw traceback; historical permission and error-formatting fixes address the reported path.

Suggested action: close resolved

Reason: The body provides an exact command and shows a 403 package_upload response being converted into a StoreReleaseError whose formatter raises KeyError. Commit ef350b470 (snapcraft#2050), explicitly titled "storeapi: properly handle lacking permission for channel," addresses the same permission-denied release path, while snapcraft#2056 addresses store-error formatting.

Evaluated by: mr-cal-bot

Impact: 35 Quick Win: 24 Complexity: 25 Confidence: 88 Actionability: 90

Issue body

While doing some testing about proper snap access via the Store APIs, I used snpacraft to try to release a revision to a channel, for a snap I don't own nor I collaborate with. Snapcraft failed, but the errors is ugly and an end-user would not understand what went wrong. Example: snapcraft release isdtest-only 1 edge Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/snapcraft/cli/_errors.py", line 55, in exception_handler echo.error(str(exception)) File "/usr/lib/python3/dist-packages/snapcraft/internal/errors.py", line 33, in __str__ return self.fmt.format([], **self.__dict__) KeyError: '"status"' Original exception was: Traceback (most recent call last): File "/usr/bin/snapcraft", line 9, in <module> load_entry_point('snapcraft==2.35', 'console_scripts', 'snapcraft')() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point return ep.load() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2229, in load return self.resolve() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2235, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/usr/lib/python3/dist-packages/snapcraft/cli/__main__.py", line 19, in <module> run(prog_name='snapcraft') File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__ return self.main(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke return callback(*args, **kwargs) File "/usr/lib/python3/dist-packages/snapcraft/cli/store.py", line 156, in release snapcraft.release(snap_name, revision, channels.split(',')) File "/usr/lib/python3/dist-packages/snapcraft/_store.py", line 534, in release channels = store.release(snap_name, revision, release_channels) File "/usr/lib/python3/dist-packages/snapcraft/storeapi/__init__.py", line 240, in release self.sca.snap_release, snap_name, revision, channels) File "/usr/lib/python3/dist-packages/snapcraft/storeapi/__init__.py", line 181, in _refresh_if_necessary return func(*args, **kwargs) File "/usr/lib/python3/dist-packages/snapcraft/storeapi/__init__.py", line 627, in snap_release raise errors.StoreReleaseError(data['name'], response) snapcraft.storeapi.errors.StoreReleaseError: <exception str() failed> The response returned from the store in this case is: (Pdb) print(response.json()) {'detail': 'Permission is required: package_upload', 'type': 'devportal:v1:macaroon-permission-required', 'title': 'Macaroon missing required permission.', 'permission': 'package_upload', 'status': 403, 'error_list': [{'message': 'Permission is required: package_upload', 'code': 'macaroon-permission-required'}]}

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 35
Quick Win: 24
Complexity: 25
Confidence: 88
Actionability: 90
close resolved 403 package_upload responses made snapcraft release fail with a StoreReleaseError formatting KeyError and raw traceback; historical permission and error-formatting fixes address the reported path.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 14
Complexity: 20
Confidence: 70
Actionability: 60
close resolved Ugly exception when releasing to a snap without package_upload permission; old error handling code caused KeyError masking real error
qwen/qwen3.8-27b
Impact: 20
Quick Win: 15
Staleness: 95
Complexity: 25
Confidence: 85
Support Request: 10
close stale Ugly traceback (KeyError in StoreReleaseError.__str__) when snapcraft release fails due to missing package_upload permission on a snap the user does not own; reported against snapcraft 2.35, no maintainer activity in ~8.6 years.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 25
Confidence: 90
Support Request: 10
close stale Snapcraft crashes with an unhandled KeyError when releasing a snap without upload permissions, instead of showing a clear 403 error message. Untriaged and inactive for over 8 years.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 20
Confidence: 85
Support Request: 10
close stale Unhandled KeyError when running snapcraft release on a snap without permissions, causing a traceback instead of a user-friendly message. Issue is over 8 years old with no activity or maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 100
Complexity: 20
Confidence: 90
Support Request: 10
close stale Unhandled KeyError when formatting a 403 permission error during snap release. Reported 8.5 years ago for deprecated snapcraft 2.35 with no maintainer activity or labels.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcraft#2050 (confidence 92%)

    Commit ef350b470 is explicitly titled "storeapi: properly handle lacking permission for channel," matching the reported unauthorized release scenario.

  • Likely Fixed By: snapcraft#2056 (confidence 82%)

    Commit 1f90b2a91 is titled "Fix formatting of some store errors," matching the formatter failure shown in the traceback.

Related issues

Issue Project State Summary Similarity
#1947067 Getting error trying to release a snap snapcraft (launchpad) open User gets store error 'You do not have permissions to modify this Snap' when releasing, despite being granted access. No snap name, command, snapcraft version, whoami output, or maintainer response; string does not exist in snapcraft source.
77%