Class[Foo] is already declared issue after changing host groups

I recently reorganized some nodes and their hostgroups in order to avoid
a hostgroup level class redefinition problem (like listed in the subject).
This was done by removing a class from the host group, then creating a
nested host group with the class[Foo] defined and moving the hosts that
need class[Foo] into the nested group. That part seemed to work just fine.

The problem in the subject line now occurs on the nodes which I left in
the parent hostgroup ( I have created a new class[Bar],
which defines class[Foo] and some specialized complex parameter logic for
class[Foo] inside. The error:

Class[Foo] is already declared in file
/etc/puppet/environments/test/modules/bar/manifests/init.pp at line X;
cannot redeclare on node

I am running Puppet with PuppetDB for storeconfigs, but I'm not sure if
that complicates things. I am not running the PuppetDB Foreman Plugin,
although I want to look into using that. The node's YAML either from
Foreman UI or from the command line does not show an explicit declaration
of class[Foo]. So I'm a bit confused. Neither Foreman or Puppet produce
any useful log info on the server end of this issue. What's even more
strange is that I have class[Bar] defined on 3 nodes in this hostgroup.
Two of them report the error about class[Foo].

Does anyone have any ideas on what might be going on here? Your time and
thoughts on the issue are much appreciated.

Kind regards,