Object is not subscriptable

Any idea regarding this error while building snap.

Sorry, an error occurred in Snapcraft: ‘NoneType’ object is not subscriptable

1 Like

You will probably need to include a bit more information about the build (logs, snapcraft.yaml too) if you expect anyone to be able to help you with this.

Hello,

Just in! I was getting one too, likely introduced with a recent routine update ( > 10 hours ago) upgrading to snapcraft, version 6.0.

Sometimes I experience occasional problems that just need a retry, but this one stuck. Started to try attentively up/downgrading, a

snapcraft refresh

seems to have sorted it. Not sure it’s the same thing, for the record, the call stack here was as below.

Best,

Janos


Traceback (most recent call last):
  File "/snap/snapcraft/6954/bin/snapcraft", line 8, in <module>
    sys.exit(run())
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1646, in invoke
    super().invoke(ctx)
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/cli/_runner.py", line 130, in run
    snap_command.invoke(ctx)
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/cli/lifecycle.py", line 387, in snap
    _execute(steps.PRIME, parts=tuple(), pack_project=True, output=output, **kwargs)
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/cli/lifecycle.py", line 102, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/lifecycle/_runner.py", line 122, in execute
    installed_snaps = _install_build_snaps(
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/lifecycle/_runner.py", line 83, in _install_build_snaps
    installed_snaps = repo.snaps.install_snaps(build_snaps)
  File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/repo/snaps.py", line 295, in install_snaps
    snap_pkg_channel = snap_info["channel"]
TypeError: 'NoneType' object is not subscriptable

(Sent it in as well a few times.)

after using a snapcraft command to build a simple hello world printing snap. I have received this much error on the console.

My snapcraft.yaml

name: hello-msg

base: core18

version: ‘0.1’

summary: Print hello app

description: | This App will be used to print hello world message.

grade: devel

confinement: devmode

parts:

hello-msg:

source: .

plugin: dump

override-build: |

  snapcraftctl build

  cd /home/pramod/Practice/hellosnap/

  ./buildhello.sh

My buildhello.sh

echo “Building Print Hello Msg” echo “” pwd echo “”

cc hello.c printmsg.c -o Hello

cp Hello Output/.

ls -ltr Output

echo “Compilation Done” echo “”

My snap was working fine till now, suddenly it started showing the error.

Thanks @brezniczky. I will try the same .

1 Like

It looks like the new software expects the (old?) data to have a key that’s not there. Kick the upstream devs to have that handled gracefully. That being said I would 247% have made such an error.

1 Like