POST request to install an already installed snap yields misleading error message

Bug #2031833 reported by Bill Kronholm
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Triaged
Medium
Unassigned

Bug Description

Making a POST request to the Snapd REST API to install a snap that is already installed yields a message saying there are no results from the store.

# snap install hello-world
hello-world 6.4 from Canonical✓ installed
# sudo curl -sS --unix-socket /run/snapd.socket http://localhost/v2/snaps -X POST -H 'Content-Type: application/json' -d '{"action": "install", "snaps": ["hello-world"]}' | jq
{
  "type": "error",
  "status-code": 400,
  "status": "Bad Request",
  "result": {
    "message": "cannot install \"hello-world\": no install/refresh information results from the store"
  }
}

It's probably better to return the same response as from snap:

# snap install hello-world
snap "hello-world" is already installed, see 'snap help refresh'

This issue may be related to this bug report: https://bugs.launchpad.net/snapd/+bug/1843725

Changed in snapd:
importance: Undecided → Medium
status: New → Triaged
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.