Npc.isValid() does not always return the correct value
Npc.isValid() does not always return the correct value when held onto for a while such as when caching (I'm not sure of the exact circumstances, but it's been an issue for years). It will continue to return true and eventually the Npc will just start returning default values. This breaks PredefinedEntity's caching mechanism.
To resolve this, an Npc despawn listener could be used to mark the npc as invalid.