yaml.constructor.ConstructorError: could not determine a constructor for the tag '!ExtractedMetadata'

Bug #1741752 reported by Alan Pope 🍺🐧🐱 πŸ¦„
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Undecided
Unassigned

Bug Description

I am building a snap using SNAPCRAFT_CONTAINER_BUILDS to 1.

I have seen this error occur a lot, and usually if I re-run or clean, it goes away, but it's quite frustrating to keep getting it.

==2.35', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/794/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/794/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/snap/snapcraft/794/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/snap/snapcraft/794/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/794/lib/python3.6/site-packages/snapcraft/cli/__main__.py", line 19, in <module>
    run(prog_name='snapcraft')
  File "/snap/snapcraft/794/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/794/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 140, in snap
    project_options, directory=directory, output=output)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_packer.py", line 45, in snap
    execute('prime', project_options)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 80, in execute
    _Executor(config, project_options).run(step, part_names)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 138, in __init__
    self._steps_run = self._init_run_states()
  File "/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 146, in _init_run_states
    dirty_report = part.get_dirty_report(step)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 171, in get_dirty_report
    state = states.get_state(self.plugin.statedir, step)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/internal/states/_state.py", line 99, in get_state
    state = yaml.load(f.read())
  File "/snap/snapcraft/794/lib/python3.6/site-packages/yaml/__init__.py", line 72, in load
    return loader.get_single_data()
  File "/snap/snapcraft/794/lib/python3.6/site-packages/yaml/constructor.py", line 37, in get_single_data
    return self.construct_document(node)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/yaml/constructor.py", line 46, in construct_document
    for dummy in generator:
  File "/snap/snapcraft/794/lib/python3.6/site-packages/yaml/constructor.py", line 408, in construct_yaml_object
    state = self.construct_mapping(node)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/yaml/constructor.py", line 204, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/yaml/constructor.py", line 129, in construct_mapping
    value = self.construct_object(value_node, deep=deep)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/yaml/constructor.py", line 86, in construct_object
    data = constructor(self, node)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/snapcraft/__init__.py", line 445, in dict_constructor
    return OrderedDict(loader.construct_pairs(node))
  File "/snap/snapcraft/794/lib/python3.6/site-packages/yaml/constructor.py", line 141, in construct_pairs
    value = self.construct_object(value_node, deep=deep)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/yaml/constructor.py", line 86, in construct_object
    data = constructor(self, node)
  File "/snap/snapcraft/794/lib/python3.6/site-packages/yaml/constructor.py", line 414, in construct_undefined
    node.start_mark)
yaml.constructor.ConstructorError: could not determine a constructor for the tag '!ExtractedMetadata'
  in "<unicode string>", line 62, column 13:
      metadata: !ExtractedMetadata
                ^
Stopping local:snapcraft-dolphin-emu

Revision history for this message
Cris Dywan (kalikiana) wrote :

Can you provide a snapcraft.yaml or repo of a project that triggers this?

Changed in snapcraft:
status: New → Incomplete
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

http://paste.ubuntu.com/26346626/
Here you go. The mbedtls part always needs a "sudo rm -rf parts/"

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

Hey Alan, from the log it seems that you built this snap using a newer snapcraft (perhaps edge) and then started working in the same dirty tree on snapcraft v2.35. Is that correct? The state tracking has changed a bit in newer snapcrafts in a way that older snapcrafts don't understand. If you need to switch back and forth, you'll probably need to clean until the newer stuff is actually released.

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Nope, ran the snapcraft command twice in a row on the same machine, no changes in between.

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

Revision 794 is v2.35. ExtractedMetadata wasn't introduced until v2.38. How is that possible?

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

I'm doing container builds. The container uses apt.

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

And you have the snapcraft snap from stable installed on your host? Christian, shouldn't it be injecting the same snap into the container?

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

Well, wait. In apt Snapcraft is also 2.35. What snapcraft do you have on your host?

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Exactly! My mistake, the container doesn't use apt, it uses the snap, but the snap is stable, and my host is tracking edge

Host:-

installed: 2.38+git3.af6551a (1021) 53MB classic

Container:-

root@snapcraft-backslide:~# which snapcraft
/snap/bin/snapcraft
root@snapcraft-backslide:~# snap list
Name Version Rev Developer Notes
core 16-2.30 3748 canonical core
snapcraft 2.35 794 canonical classic

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

Okay, that's the problem. Christian, can you take a look at this when you're able? Something seems wrong with the injection-- we should be injecting the rev being used on the host, right?

Changed in snapcraft:
status: Incomplete → New
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Uh. I just did it again and now I have 2.38? Did you do something in the interim 17 minutes?

root@snapcraft-orbitdb-cli:~# snap list
No snaps are installed yet. Try "snap install hello-world".
root@snapcraft-orbitdb-cli:~# snap list
Name Version Rev Developer Notes
core 16-2.30 3748 canonical core
snapcraft 2.38+git3.af6551a 1021 canonical classic

Revision history for this message
Cris Dywan (kalikiana) wrote :

Can you clarify if you used `snapcraft clean` or `lxc delete` in-between to remove the container?

Snapcraft doesn't update snaps in the container automatically once the container has been created and it doesn't change the channel after the fact either - *unless* you do an explicit `snapcraft refresh`.

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

I definitely didn't do lxc delete, and don't believe I did snapcraft clean.

Revision history for this message
Kyle Fazzari (kyrofa) wrote :
Cris Dywan (kalikiana)
Changed in snapcraft:
status: New → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
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.