Error 21 and 22: the game can't save a file
Codes 21 and 22 show up when the game can't write a save to disk. In an EA forum thread, the cause turned out to be the Windows protection called Controlled folder access: it was blocking writes to Documents.
Why this happens
Controlled folder access is a Windows Defender protection against ransomware. It stops unfamiliar programs from changing files in Documents. The game stores saves exactly there, so the write is blocked and the game shows an error. Other antivirus programs can act the same way. Mods usually have nothing to do with it.
What to do
- Open Windows Security → Virus & threat protection → Manage ransomware protection.
- Open "Block history" and look for
TS4_x64.exeor the EA app there. - Click "Allow an app through Controlled folder access" and add
TS4_x64.exefrom the game folder (…\The Sims 4\Game\Bin\). - If you use a different antivirus, add the game and the
Documents\Electronic Arts\The Sims 4folder to its exclusions. - If Documents syncs with OneDrive, pause the sync and try saving.
- Close extra programs and repair the game in the EA app (Library → The Sims 4 → ⋯ → Repair).
Don't turn the protection off for good: it's enough to let the game write.
How the app helps
The "Why mods aren't showing up" section in Sims 4 Mod Doctor (free) checks the same Windows restrictions and OneDrive that get in the way of the game reading and writing files in Documents, and suggests how to fix them. In the "Saves" section you can back up your saves before changing anything.
Frequently asked questions
Are error 22 and "Sims Delivery Error" the same thing?
On PC they're often seen together. The steps are the same: check Windows protection, antivirus and OneDrive, then repair the game.
Error 21 came back after a Windows update.
After big updates, protection settings can reset. Check the block history and the list of allowed apps again.