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

Bug #1716055 reported by Leo Arias
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Sergio Schvezov

Bug Description

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>
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/", line 697, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/cli/", line 110, in run
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/", line 553, in forward
    return self.invoke(cmd, **kwargs)
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/cli/", line 132, in snap
    project_options, directory=directory, output=output)
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/", line 349, in snap
    execute('prime', project_options)
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/", line 120, in execute
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/repo/", line 167, in install_snaps
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/repo/", line 136, in install
    if self.is_classic():
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/repo/", line 119, in is_classic
    return store_channels[]['confinement'] == 'classic'
KeyError: 'latest/candidate'

To reproduce, run the latest unreleased snapcraft with the snapcraft.yaml from

It works when an open channel is specified, like:

build-snaps: [u1test-snap-with-tracks/latest/stable]

Changed in snapcraft:
importance: Undecided → High
assignee: nobody → Sergio Schvezov (sergiusens)
milestone: none → 2.35
status: New → Triaged
Changed in snapcraft:
milestone: 2.35 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.