Snapcraft prime now fails with Python TypeError (on build.snapcraft.io)

On build.snapcraft.io, today I’m getting an unexpected error during the prime stage. Things worked fine yesterday, and I don’t think this is due to changes in the code that I’m packaging (my snapcraft.yaml has remained the same)

A full log example is here: https://launchpad.net/~build.snapcraft.io/+snap/908277a77436b2b858d32d6cd0bc859a/+build/798502
the key part being this bit at the end:

Priming ammp-edge 
Sorry, an error occurred in Snapcraft:
join() argument must be str or bytes, not 'NoneType'
Traceback (most recent call last):
  File "/snap/snapcraft/3914/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==3.9.1', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/cli/_runner.py", line 109, in run
    snap_command.invoke(ctx)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/cli/_command.py", line 87, in invoke
    return super().invoke(ctx)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 261, in snap
    _execute(steps.PRIME, parts=[], pack_project=True, output=output, **kwargs)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 66, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 123, in execute
    executor.run(step, part_names)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 177, in run
    self._handle_step(part_names, part, step, current_step, cli_config)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 191, in _handle_step
    getattr(self, "_run_{}".format(current_step.name))(part)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 266, in _run_prime
    self._run_step(step=steps.PRIME, part=part, progress="Priming")
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 310, in _run_step
    getattr(part, step.name)()
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 798, in prime
    self._do_runner_step(steps.PRIME)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 245, in _do_runner_step
    return getattr(self._runner, "{}".format(step.name))()
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 91, in prime
    "override-prime", self._override_prime_scriptlet, self._primedir
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 137, in _run_scriptlet
    scriptlet_name, function_call.strip()
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 193, in _handle_builtin_function
    function(**function_args)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 810, in _do_prime
    dependency_paths = self._handle_elf(snap_files)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 825, in _handle_elf
    content_dirs = self._project_options._get_provider_content_dirs()
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/project/_project.py", line 87, in _get_provider_content_dirs
    return self._snap_meta.get_provider_content_directories()
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/meta/snap.py", line 116, in get_provider_content_directories
    provider_path = common.get_installed_snap_path(provider)
  File "/snap/snapcraft/3914/lib/python3.6/site-packages/snapcraft/internal/common.py", line 92, in get_installed_snap_path
    return os.path.join(os.path.sep, "snap", snap_name, "current")
  File "/snap/snapcraft/3914/usr/lib/python3.6/posixpath.py", line 94, in join
    genericpath._check_arg_types('join', a, *p)
  File "/snap/snapcraft/3914/usr/lib/python3.6/genericpath.py", line 149, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'
You can find the traceback in file '/tmp/tmpyjzhk0gy/trace.txt'.
Build failed
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 266, in run
    self.build()
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 255, in build
    env=env)
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 102, in run_build_command
    return self.backend.run(args, env=full_env, **kwargs)
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/lxd.py", line 527, in run
    subprocess.check_call(cmd, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['lxc', 'exec', 'lp-bionic-amd64', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build-request-id": "lp-53846713", "build-request-timestamp": "2020-01-15T21:15:47Z", "build_url": "https://launchpad.net/~build.snapcraft.io/+snap/908277a77436b2b858d32d6cd0bc859a/+build/798502"}', '--env', 'SNAPCRAFT_BUILD_ENVIRONMENT=host', '--env', 'http_proxy=http://10.10.10.1:8222/', '--env', 'https_proxy=http://10.10.10.1:8222/', '--env', 'GIT_PROXY_COMMAND=/usr/local/bin/snap-git-proxy', '--', '/bin/sh', '-c', 'cd /build/ammp-edge && linux64 snapcraft']' returned non-zero exit status 1

A similar error is mentioned in this recent bug report: https://bugs.launchpad.net/snapcraft/+bug/1857019 - but this is reported to occur under different circumstances, i.e. when no base is specified in snapcraft.yaml. In my snapcraft.yaml (https://github.com/ammpio/ammp-edge/blob/master/snap/snapcraft.yaml) I’ve had base: core18 specified all the way along. Prompted by the bug report, I figured I’d try adding build-base: core or build-base: core18 just in case it makes a difference, but neither did.

Any ideas what’s going on? Did something change in the snapcraft version/behavior on build.snapcraft.io?

I am so sorry for the inconvenience.

This is most likely a regression in the latest version of Snapcraft introduced with the feature of not listing missing depdendencies when using the content interface. We will fix this ASAP in the morning.

Heads up @cjp256

This fixes the issue:

https://github.com/snapcore/snapcraft/pull/2881

Will get back to you when this is in place, most likely tomorrow morning.

1 Like

And is now in stable.

Thanks @sergiusens for the quick turnaround! I was out for a few days but back now and just tried it again and all works great now :+1:

1 Like