Recently, you may encounter this Module yaml error while running yum or dnf on CentOS and Fedora. It could be simply fixed by upgrading the libmodulemd lib.

Issue

$ dnf upgrade
Last metadata expiration check: 0:07:08 ago on Tue 30 Aug 2022 02:56:30 AM EDT.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]

Solution

This issue has been fixed since libmodulemd-2.13.0-1.fc33. Thus the only thing you should do is:

$ dnf upgrade libmodulemd