Snapcraft errors when releasing a snap
Metadata
Current evaluation
Resolved by improving snapcraft's error handling to check HTTP status codes before JSON decoding, alongside a fix for the underlying store race condition (bug #1610948).
Resolution: closed resolved
Reason: The issue was closed as resolved because the underlying store race condition was fixed (bug #1610948) and snapcraft's error presentation was improved to gracefully handle non-200 responses.
Evaluated by: mr-cal-bot
No scores available.
Issue body
I've been releasing lots of snaps to the staging store by running:
snapcraft push <snap> --release <channel>
... and they've all gone fine, but one upload I got this:
```
Uploading ./thomir-says_0.0.1a_amd64.snap [===========================================================================================================================================] 100%
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3/dist-packages/snapcraft/storeapi/__init__.py", line 442, in _update_status
for content in self._get_status():
File "/usr/lib/python3/dist-packages/snapcraft/storeapi/__init__.py", line 452, in _get_status
content = requests.get(self.__status_details_url).json()
File "/usr/lib/python3/dist-packages/requests/models.py", line 808, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 516, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
```
This is when snapcraft is in the 'processing' phase, which I believe is when it's actually relasing the snap, rather than pushing it.
Snapcraft is then stuck in the 'Processing...' stage, and never exits.
The store should never send bad data (I'll try and find something in the staging store logs and report a bug there as well), but snapcraft should handle it better.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | closed resolved | Resolved by improving snapcraft's error handling to check HTTP status codes before JSON decoding, alongside a fix for the underlying store race condition (bug #1610948). | |
| stealth/space-bunny-alpha |
Impact:
46
Quick Win:
31
Complexity:
24
Confidence:
89
Actionability:
90
|
close resolved | Upload status polling could race with store processing, crash the release worker, and leave Snapcraft at Processing; commit 2cae24aa5 later hardened this polling path. | |
| stealth/space-bunny-alpha |
Impact:
46
Quick Win:
34
Complexity:
20
Confidence:
92
Actionability:
92
|
close resolved | An intermittent store-side 404 during status polling made Snapcraft decode a plain response, crash a worker thread, and hang the release; the current craft-store-based client handles HTTP errors first. | |
| qwen/qwen3.6-35b-a3b |
Impact:
30
Quick Win:
27
Complexity:
10
Confidence:
90
Actionability:
100
|
close resolved | Old storeapi JSONDecodeError during snap release fixed by replacing storeapi with craft-store in PR #3692. | |
| qwen/qwen3.8-27b |
Impact:
30
Quick Win:
18
Staleness:
95
Complexity:
40
Confidence:
75
Support Request:
10
|
close stale | Snapcraft push --release hangs in 'Processing...' after a JSONDecodeError from the store status endpoint (storeapi._update_status). No maintainer activity in ~10 years; the storeapi module no longer exists in the codebase. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
98
Complexity:
15
Confidence:
90
Support Request:
10
|
close stale | Unhandled JSONDecodeError during snap release causes snapcraft to hang. Reported ~10 years ago using Python 3.5 with no maintainer response. Clearly obsolete due to age and API changes. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
98
Complexity:
15
Confidence:
95
Support Request:
10
|
close stale | Unhandled JSONDecodeError during snap release causes snapcraft to hang. Issue is nearly 10 years old with no maintainer interaction or updates. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
98
Complexity:
15
Confidence:
95
Support Request:
5
|
close stale | Unhandled JSONDecodeError during snap release causes snapcraft to hang. Reported ~10 years ago using Python 3.5, with zero comments and no maintainer interaction. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Related To:
launchpad#1610948
(confidence 95%)
Store-side bug tracking the asynchronous race condition that caused the 404 errors.
-
Likely Fixed By:
snapcraft#836
(confidence 90%)
Proposed fix to validate HTTP status codes before parsing JSON responses.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1761488 snapcraft 2.39.2 failed to release a snap: snapcraft.storeapi.errors.StoreReleaseError: <exception str() failed> | snapcraft (launchpad) | closed | Root cause was Mozilla-side (passing a string instead of a list of channels to _store.push); Snapcraft's unprintable StoreReleaseError was fixed by commit ef350b47 and PR #2056 (merged as 1f90b2a9), shipped in 2.41. | |
| #1765671 Strange technical error message when querying store | snapcraft (launchpad) | closed | Fixed by snapcore/snapcraft#2094, merged as 0d8602cc5, improving handling and presentation of Store API network errors and retries. | |
| #4863 fix(cli): properly capture store errors | snapcraft | merged | Merged #4863 in commit 426df7ec3, restoring legacy-style store-error capture so store failures are no longer reported as Snapcraft internal errors. | |
| #1763721 snapcraft status crashing "TypeError: Can't convert 'NoneType' object to str implicitly" | snapcraft (launchpad) | closed | Store cleanup removed the conflicting name-dispute record, and snapcore/snapcraft#2115 (12828eba2) added a missing-snap-ID guard for snapcraft status. | |
| #1663383 Snapcraft needs a better User-Agent header for store requests. | snapcraft (launchpad) | closed | Fixed by merged PR #1188 (commit 40aec20bf), adding Snapcraft version, OS, and architecture details to Store User-Agent headers. | |
| #5188 fix: improve error message from snapd pack | snapcraft | merged | Merged PR #5188 in commit a9fc44093, improving snapd pack failures by surfacing snapd's error output and fixing snapcraft#4499. | |
| #1791968 Snapcraft lies when submission to sentry fails | snapcraft (launchpad) | closed | Snapcraft now handles Sentry submission failures gracefully instead of falsely reporting success. Fix merged in canonical/snapcraft#2271 via commit 859c111e5. | |
| #2056 Fix formatting of some store errors | snapcraft | merged | PR #2056 by cjwatson merged as commit 1f90b2a91, fixing store error messages that were pre-formatted with str.format so raw JSON braces no longer crash SnapcraftError.__str__ (LP: #1761488). | |
| #585 Improve the store errors returning exceptions | snapcraft | merged | Merged in canonical/snapcraft#585 via commit ddbbdbd06, refactoring store error handling to raise exceptions and addressing LP #1594636. | |
| #1967722 snapcraft upload --release fails for registered snap | snapcraft (launchpad) | closed | Upload succeeded after store registration/account access was confirmed; no Snapcraft code change was needed. |