The reason this is happening is because of not clearing the caches after adding, removing, moving the location of, or updating your Mods and/or game. OR. Its because of legit corrupted Mods or CC.
Either way, the way this is typically resolved is by:
1. Removing the specific Mod named in the pop up- This happens sometimes with CC. If CC is for a different Sims version and was downloaded thinking it was for TS4. Or if the CC is not formatted correctly, and the game mechanics catches it. It happens for seemingly no reason at all too. I've had this happen as have other Simmers. Usually its for newly downloaded content, but it can also happen for content you've had in your game for years. -shrug- In your specific case, it doesn't sound like its targeting one piece of content, rather code in general.
-- but if no specific CC or Mod is mentioned tho --
2. Try doing a Game Repair- Sometimes you can do a Game Repair, and it will also solve this problem.
!!! _WORD OF CAUTION_ !!!!
Its highly advised to completely remove and backup any Mods, Saves, Tray, UserSettings, and Screenshots prior to this process, due to complete folder reset from repairs. (This shouldn't happen in most cases, but its happened to me TWICE. And others, so I always warn Simmers now)
If a Repair doesn't work, you can try a Soft Uninstall, after that, the only option is to 50/50 your Mods folder, and try to locate the problem manually.
+++ Remember +++
Anytime you make changes to Script Mods (any mod that contains a TS4SCRIPT. Even if it contains an additional Package) You should delete the localthumbcache package from TS4 folder.
You should ALWAYS do this when:
1. Adding new scripts.
2. Deleting old scripts
3. Updating broken or outdated scripts
4. Moving the location of your Mods folder.
5. Before running your game after an update.
&&&& To Cut Down On This Specific Problem:
Always remove the Mods folder from TS4 folder, and delete the localthumbcache package BEFORE doing any updates or Repairs to your game.(I take this a step further and also make a backup of my Saves and Tray) After the Repair or update, RUN the game without your Mods & CC installed. Make sure the issue is resolved, BEFORE putting your Mods folder back. (I recommend creating a Test Save, either with CC or without. Or separate saves for both. I have both in separate saves) then you don't have to worry about messing up your Current Families and Legacy Saves with playtesting.