Snapcraft push error: "KeyError: 'architectures'"

Hey guys,
We are trying to push our application to the snap store for the first time and are running into errors with snapcraft push.

The app is an electron app that is packaged using electron-builder with snap. We successfully end up with a built myapp_0.0.1_amd64.snap file from electron-builder.

We have registered our app name with the snap store.

Whenever I try to push the app with snapcraft push myapp_0.0.1_amd64.snap I get the following:

$ snapcraft push myapp_0.0.4_amd64.snap
Pushing myapp_0.0.4_amd64.snap
Preparing to push '/home/me/app/dist/myapp_0.0.4_amd64.snap' to the store.
Traceback (most recent call last):
  File "/snap/snapcraft/1094/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.39', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/1094/usr/lib/python3.6/site-packages/pkg_resources/", line 565, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/snap/snapcraft/1094/usr/lib/python3.6/site-packages/pkg_resources/", line 2631, in load_entry_point
    return ep.load()
  File "/snap/snapcraft/1094/usr/lib/python3.6/site-packages/pkg_resources/", line 2291, in load
    return self.resolve()
  File "/snap/snapcraft/1094/usr/lib/python3.6/site-packages/pkg_resources/", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/snapcraft/cli/", line 43, in <module>
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/click/", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/click/", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/click/", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/click/", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/click/", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/snapcraft/cli/", line 149, in push
    snapcraft.push(snap_file, channel_list)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/snapcraft/", line 481, in push
    arch = snap_yaml['architectures'][0]
KeyError: 'architectures'

What happens if you add architectures: [amd64] to your snapcraft.yaml?

electron-builder seems to be producing a snap without an architectures key (I don’t believe it uses snapcraft to do this). Since snapcraft is used to creating the snaps and it always puts one in there, it seems to be assuming that it’s in there. @chipaca is it valid to have a snap.yaml with no architectures?

yes, a missing architectures field is equivalent to ["all"].

(which electron snaps almost certainly are not)

Indeed. @kspearrin the failure to push is a bug in snapcraft, but there’s also a bug in electron-builder-- the snaps it’s producing are claiming to be compatible with all architectures (armhf, arm64, amd64, etc.).

don’t forget ppc64el!

And s390x. And there’s another one in there… gosh. i386? Nah…

Here’s the fix for Snapcraft: .

I opened an issue with electron-builder here:

electron-builder uses snapcraft pack to produce snap from prebuilt template (no one can wait 5-20 minutes to build snap and build only on Linux). I will fix generated snap.yml for this case today.