The snap CLI incorrectly indicates that installation is possible from a closed channel.

Bug #2091562 reported by Benjamin Schimke
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
New
Undecided
Unassigned

Bug Description

### Bug Description

Hi everyone,

We maintain the `k8s` snap and provide the following channels for each Kubernetes release:

```
1.XX
1.XX-classic
1.XX-moonray
```

We now had to close the 1.XX channels.

However, the snap CLI is now suggesting that the installation can proceed from higher-risk channels when attempting to install from 1.31/candidate, even though the channel is closed:
```
root@c2:~# sudo snap install k8s --channel=1.31/candidate
error: snap "k8s" is not available on 1.31/candidate but is available to install on the following
       channels:

       1.31/beta snap install --channel=1.31/beta k8s
       1.31/edge snap install --channel=1.31/edge k8s

       Get more information with 'snap info k8s'.
```
Further attempts to install from 1.31/beta and 1.31/edge produce similar errors, with the CLI falling back to listing other tracks:

```
root@c2:~# sudo snap install k8s --channel=1.31/edge
error: snap "k8s" is not available on 1.31/edge but is available to install on the following tracks:

       latest/candidate snap install --candidate k8s
       ...
       1.31-classic/candidate snap install --channel=1.31-classic/candidate k8s
       1.31-classic/beta snap install --channel=1.31-classic/beta k8s
       1.31-classic/edge snap install --channel=1.31-classic/edge k8s
       1.31-moonray/candidate snap install --channel=1.31-moonray/candidate k8s
       ...

       Please be mindful that different tracks may include different features. Get more information
       with 'snap info k8s'.
```
Let us know if this is intended behavior or have suggestions for handling closed channels in this scenario.

Thanks!

### To Reproduce

Try to install from any risk level in 1.31
```
sudo snap install k8s --channel 1.31/candidate
```

### Environment

tested on LXD 22.04 but this also happens in other environments.

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.