snapcraft status crashing "TypeError: Can't convert 'NoneType' object to str implicitly"

Bug #1763721 reported by Alan Pope 🍺🐧🐱 🦄
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snap Store Server
Won't Fix
High
Celso Providelo
Snapcraft
Fix Released
High
Kyle Fazzari

Bug Description

root@snapcrafters:~# snapcraft version
snapcraft, version 2.40

root@snapcrafters:~# snap info links
name: links
summary: Web browser running in text mode
publisher: snapcrafters
contact: https://github.com/snapcrafters/links/issues
description: |
  Links is a text mode WWW browser, similar to Lynx. It displays tables, frames,
  downloads on background, uses HTTP/1.1 keepalive connections.
snap-id: XwrNY1ywHBH1BLx60DcXsPOU0xketHwh
channels:
  stable: 2.12-1 (2) 1MB -
  candidate: ↑
  beta: ↑
  edge: 2.15 (3) 1MB -

root@snapcrafters:~# snapcraft status links
Traceback (most recent call last):
  File "/usr/bin/snapcraft", line 9, in <module>
    load_entry_point('snapcraft==2.40', 'console_scripts', 'snapcraft')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/__main__.py", line 43, in <module>
    run(prog_name='snapcraft')
  File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/store.py", line 247, in status
    snapcraft.status(snap_name, series, arch)
  File "/usr/lib/python3/dist-packages/snapcraft/_store.py", line 717, in status
    status = store.get_snap_status(snap_name, series, arch)
  File "/usr/lib/python3/dist-packages/snapcraft/storeapi/_store_client.py", line 194, in get_snap_status
    self.sca.snap_status, snap_id, series, arch)
  File "/usr/lib/python3/dist-packages/snapcraft/storeapi/_store_client.py", line 85, in _refresh_if_necessary
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/storeapi/_sca_client.py", line 281, in snap_status
    url = 'snaps/' + snap_id + '/state'
TypeError: Can't convert 'NoneType' object to str implicitly

Tags: stacktrace
Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) wrote :

Some background which may help debug.

I ran "snapcraft register links" a week ago which told me it was already registered.
I requested that links be transferred from zyga to snapcrafters

So now there's two links in the store, one attempted to be registered by me (snapcrafters) and one registered by zyga and transferred by the store team.

I spoke to Adam Conrad who revoked the request I'd made initially, but the snap still doesn't show up when we do "snapcraft status" when logged into the store as the snapcrafters user.

Revision history for this message
Adam Collard (adam-collard) wrote :

> I spoke to Adam Conrad who revoked the request I'd made initially, but the snap still doesn't show up when we do "snapcraft status" when logged into the store as the snapcrafters user.

Alan actually spoke to me, not infinity.

The root cause of this issue is that there are two package declarations for the 'links' name, both owned by the snap advocacy team.

The store API is returning the one with the revoked name when queried for account-information by snapcraft which is then choking on the missing snap_id (because, luckily, there is no snap associated with the revoked name).

The store side bug is allowing this situation to occur. We will discuss options to unblock this particular instance and then fix the general case to not allow us to end up here again.

Revision history for this message
Philip Roche (philroche) wrote :

I am seeing the same issues with snap lpshipit [0].

snapcraft, version 2.40.1

$ /snap/bin/snapcraft status lpshipit

"""
Traceback (most recent call last):
  File "/snap/snapcraft/1345/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.40.1', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/1345/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 565, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/snap/snapcraft/1345/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/snap/snapcraft/1345/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/snap/snapcraft/1345/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/cli/__main__.py", line 43, in <module>
    run(prog_name='snapcraft')
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/cli/store.py", line 247, in status
    snapcraft.status(snap_name, series, arch)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/_store.py", line 717, in status
    status = store.get_snap_status(snap_name, series, arch)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/storeapi/_store_client.py", line 194, in get_snap_status
    self.sca.snap_status, snap_id, series, arch)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/storeapi/_store_client.py", line 85, in _refresh_if_necessary
    return func(*args, **kwargs)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/storeapi/_sca_client.py", line 281, in snap_status
    url = 'snaps/' + snap_id + '/state'
TypeError: must be str, not NoneType
"""

Other snaps registered to the same account work fine.

[0] https://dashboard.snapcraft.io/snaps/lpshipit/

Celso Providelo (cprov)
Changed in snapstore:
status: New → Confirmed
assignee: nobody → Celso Providelo (cprov)
Revision history for this message
Celso Providelo (cprov) wrote :

The problem should be fixed for both `links` and `lpshipit` snaps, the conflicting name-dispute request was removed.

Changed in snapcraft:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Sergio Schvezov (sergiusens)
tags: added: stacktrace
Revision history for this message
Philip Roche (philroche) wrote :

I confirm it is now working for lpshipit.

Thank you

Changed in snapcraft:
milestone: none → 2.43
Revision history for this message
Kyle Fazzari (kyrofa) wrote :

Proposed fix for the snapcraft CLI to stop dumping a traceback in this situation: https://github.com/snapcore/snapcraft/pull/2115

Changed in snapcraft:
status: Triaged → In Progress
assignee: Sergio Schvezov (sergiusens) → Kyle Fazzari (kyrofa)
Changed in snapcraft:
status: In Progress → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
Daniel Manrique (roadmr)
Changed in snapstore:
importance: Undecided → High
Revision history for this message
Celso Providelo (cprov) wrote :

The general API guidelines are kept and snapcraft is handling with any error in a more appropriate way now.
The data organization problem in the Store, duplicated records for revoked & approved names, is tracked in https://bugs.launchpad.net/snapstore/+bug/1778493.

Changed in snapstore:
status: Confirmed → Won't Fix
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.