← Back to issue list

It is not possible to install a build-snap with a closed risk

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1716055
Type
issue
State
open
Author
~elopio
Labels
Created
Updated
Closed

Current evaluation

build-snaps with a closed channel (e.g. latest/candidate) crashes with KeyError instead of falling back to the next open risk level; filed by maintainer elopio 9 years ago, zero activity, old internal/repo code path no longer exists in current architecture

Suggested action: close stale

Reason: The issue is 9 years old with zero comments or labels, and the traceback references snapcraft/internal/repo/snaps.py which no longer exists in the current codebase (the internal/ directory has been replaced by snapcraft/parts/, snapcraft/store/, and snapcraft/models/ in a full architectural rewrite). The build-snaps feature still exists (83 hits) but the implementation is entirely different, making the original KeyError unlikely to reproduce in the same form. A maintainer should verify the new build-snaps channel resolution handles closed risks before closing.

Impact: 35 Quick Win: 19.25 Staleness: 95 Complexity: 45 Confidence: 55 Support Request: 5

Issue body

When trying to install a snap from a risk that is closed, the snap from the lower risk level that follows it will be installed. For example, in: $ snapcraft status u1test-snap-with-tracks Track Arch Channel Version Revision latest all stable latest-stable 2 candidate ^ ^ beta ^ ^ edge latest-edge 3 test-track-1 all stable - - candidate - - beta test-track-1-beta 5 edge ^ ^ If I run sudo snap install u1test-snap-with-tracks --candidate, because candidate is closed, stable will be installed instead. However, when using build-snaps in snapcraft, if I specify: build-snaps: [u1test-snap-with-tracks/latest/candidate] I get: Traceback (most recent call last): File "/home/ubuntu/venv/snapcraft/bin/snapcraft", line 6, in <module> exec(compile(open(__file__).read(), __file__, 'exec')) File "/home/ubuntu/workspace/canonical/snapcraft/bin/snapcraft", line 36, in <module> obj=dict(project=snapcraft.ProjectOptions())) File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 1043, in invoke return Command.invoke(self, ctx) File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/cli/__init__.py", line 110, in run ctx.forward(lifecyclecli.commands['snap']) File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 553, in forward return self.invoke(cmd, **kwargs) File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/cli/lifecycle.py", line 132, in snap project_options, directory=directory, output=output) File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/lifecycle.py", line 349, in snap execute('prime', project_options) File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/lifecycle.py", line 120, in execute repo.snaps.install_snaps(config.build_snaps) File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/repo/snaps.py", line 167, in install_snaps snap_pkg.install() File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/repo/snaps.py", line 136, in install if self.is_classic(): File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/repo/snaps.py", line 119, in is_classic return store_channels[self.channel]['confinement'] == 'classic' KeyError: 'latest/candidate' To reproduce, run the latest unreleased snapcraft with the snapcraft.yaml from http://paste.ubuntu.com/25492456/ It works when an open channel is specified, like: build-snaps: [u1test-snap-with-tracks/latest/stable]

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 35
Quick Win: 19.25
Staleness: 95
Complexity: 45
Confidence: 55
Support Request: 5
close stale build-snaps with a closed channel (e.g. latest/candidate) crashes with KeyError instead of falling back to the next open risk level; filed by maintainer elopio 9 years ago, zero activity, old internal/repo code path no longer exists in current architecture
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 25
Confidence: 85
Support Request: 0
close stale Bug report from 2017 where specifying a closed channel for a build-snap causes a KeyError. No maintainer interaction, references outdated Python 3.5 and legacy snapcraft internals.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 45
Confidence: 90
Support Request: 10
close stale Snapcraft throws a KeyError when specifying a closed channel for a build-snap, unlike the snap CLI which falls back. Unaddressed for nearly 9 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 30
Confidence: 85
Support Request: 5
close stale Snapcraft fails with a KeyError when installing a build-snap from a closed channel. The report provides a traceback and reproduction steps but has received no maintainer response or labels in over eight years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 45
Confidence: 90
Support Request: 15
close stale Snapcraft throws a traceback when installing a build-snap from a closed channel, unlike the snap CLI which falls back gracefully. The report has zero comments and no labels, remaining unaddressed and needing triage.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1716054 It is not possible to install a build-snap with the default track snapcraft (launchpad) open Snapcraft build-snaps fails with KeyError when a channel is given without a track (e.g. snap/edge), because the code looks up store channels by the bare channel name instead of track/risk. Old bug, no maintainer response, no labels.
70%