If it’s caused by an outdated cache, you need to clear the system using sudo dnf, clean all, and try the command again. However, if the culprit is corrupted files, you better reinstall the hostname or systemd packages that provide these commands.