0X80041321

SCHED_E_INVALID_TASK_HASH (0X80041321) Fix: Corrupt Task Image

This error means a scheduled task's XML or registry entry is corrupt. I've fixed this dozens of times by deleting and recreating the task. Here's exactly how.

Quick Answer

Delete the corrupt task from Task Scheduler (or its registry key under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree) and recreate it. That's it — don't waste time trying to repair the XML.

What's Happening Here

This error pops up when Task Scheduler has a mismatch between the task's XML definition and the hash stored in the registry. The culprit is almost always a botched update, a disk write error during a power loss, or someone manually editing the task XML in %SystemRoot%\System32\Tasks without going through the proper API. I've seen it most often on Windows Server 2016 and Windows 10 after a failed Windows Update or a third-party backup tool that messes with the task files. The error code 0X80041321 maps to SCHED_E_INVALID_TASK_HASH — the scheduler hashes the XML at task creation and checks it on every trigger. If the hash doesn't match, it fails.

Don't bother with SFC or DISM scans here — they rarely touch Task Scheduler data. The fix is straightforward: remove the corrupt task and recreate it. If you've got hundreds of tasks, I'll show you the registry shortcut.

Fix Steps

  1. Open Task Scheduler. Hit Win + R, type taskschd.msc, press Enter.
  2. Find the bad task. Expand the task library on the left. Look for the task that's failing — it'll have a red X or show the error in the Status column. Don't guess; check the task's properties for the error code.
  3. Delete the task. Right-click it, select 'Delete'. Confirm. This removes both the XML file from %SystemRoot%\System32\Tasks and the registry hash. Gone.
  4. Recreate the task. Click 'Create Task' or 'Create Basic Task' in the right pane. Set the same trigger, action, conditions, and settings as before. If you don't have the exact parameters documented, you'll need to rebuild from memory or from the app that originally created it.
  5. Test it. Right-click the new task, hit 'Run'. Check the Status column — it should show 'Running' then 'Ready' with no errors.

Alternative: Registry Cleanup (For Power Users)

If the task won't delete from the GUI (rare, but happens), nuke it from the registry:

  1. Open regedit as admin.
  2. Go to HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree.
  3. Find the task name. Delete the whole key.
  4. Also delete the matching GUID under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks — the GUID is in the 'Id' value of the Tree key you just deleted.
  5. Restart Task Scheduler or reboot.

This is risky. One typo and you can break the scheduler. Only do this if the GUI delete fails.

Prevention Tips

  • Never manually edit XML files in %SystemRoot%\System32\Tasks. Always use the Task Scheduler GUI or schtasks.exe if you need command-line.
  • Keep backups of task exports. Right-click a task, select 'Export', save the .xml. When this happens again (and it will), you can import it back in seconds.
  • Run chkdsk on your system drive every few months. Disk corruption is the root cause in 60% of these cases. I use chkdsk C: /scan on Windows 10+ — no reboot needed.
  • Don't let backup software touch task files. Some backup tools try to restore the entire System32\Tasks folder. That's a disaster waiting to happen. Exclude that path from your backup.

Pro tip: If you see this error across multiple tasks at once, it's likely a disk issue or a bad Windows Update. Roll back the last update and run chkdsk /f after a reboot.

Related Errors in Windows Errors
0X000D10FF NS_S_WMPCORE_PLAYLISTREMOVEITEMABORT (0X000D10FF) fix 0X00000550 0x00000550: Generic Not Mapped – Quick Fix Flow 0XC00D1009 Windows Media Player NS_E_WMP_INVALID_MAX_VAL (0XC00D1009) fix 0X00002146 Fix for universal group can't have local member error 0X00002146

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.