Fix SCHED_E_INVALID_TASK (0X8004130E) in Windows Task Scheduler
Task Scheduler throws 0X8004130E when a task's XML is corrupt or it references a missing trigger/action. This usually hits after importing tasks from another machine.
You see SCHED_E_INVALID_TASK (0X8004130E) when you try to run, enable, or edit a scheduled task. The exact error message reads: "The object is either an invalid task object or is not a task object." This hits most often right after you've imported a task from a different Windows version—say, from Windows 10 to Windows 11—or after restoring a task backup from an old system backup tool. Another common trigger: you created a task by hand-editing the .xml file and made a typo in the task schema.
What's actually happening here
Task Scheduler stores each task as an XML file under C:\Windows\System32\Tasks. The error means the XML parser can't make sense of the task definition. This isn't a permissions issue or a missing DLL—it's a data format problem. The root cause is almost always one of three things:
- Schema mismatch: the XML was exported from a newer version of Task Scheduler (e.g., Windows 10 22H2) and imported into an older one (e.g., Windows 10 1809). The parser finds tags it doesn't recognize.
- Missing referenced object: the task XML references a COM handler, a trigger type, or an action that isn't registered on your system. For example, a task that calls a PowerShell script but the
<Command>element points to a path that no longer exists. - Manual editing corruption: you opened the XML in Notepad, changed a value, and accidentally broke the XML structure—like a missing closing tag or an invalid character in a CDATA section.
The reason step 3 (deleting and recreating the task) always works is that it bypasses the broken XML entirely. But you don't always want to blow away the task—sometimes you need to preserve the settings.
How to fix it
I've ordered these steps from least destructive to most. Start with step 1.
- Export and re-import the task
Open Task Scheduler, find the failing task, right-click it, and select Export. Save the.xmlto your desktop. Now right-click Task Scheduler Library and choose Import Task. Point it at that file. If the import succeeds, delete the old broken task. The export process re-serializes the task into a clean XML format, often stripping out malformed bits. - Validate the XML schema
If step 1 fails, open the exported.xmlin Notepad++ or VS Code. Check the first few lines—the schema URL should behttp://schemas.microsoft.com/windows/2004/02/mit/task. If it shows a different URL (like a Vista-era schema), that's your problem. You can manually change it to the modern one, but I've seen that cause other issues. Better to recreate the task from scratch using the GUI, then export it to get a clean schema. - Delete and recreate the task
If neither of the above works, delete the task entirely. Right-click it, select Delete. Then create a new task with the same triggers and actions. This is the nuclear option, but it's the only fix for tasks where the XML is so damaged that the exporter itself throws the same error. I've seen this happen when a task was migrated through multiple Windows upgrades.
What to check if it still fails
If you've recreated the task and it still throws 0X8004130E, it's not the task itself—it's a dependency. Check these two things:
- The task user account: if the task runs as a local user account and that account was deleted, Windows flags the task as invalid. Change the task to run as SYSTEM temporarily to test. Right-click the task, Properties, then under Security options, select Run whether user is logged on or not and set the account to
NT AUTHORITY\SYSTEM. If it works, the original account is the issue. - Corrupted Task Scheduler cache: buried in
C:\Windows\System32\Tasks\Microsoft\Windowsthere's a hiddenTasksCachefile that can get stale. Stop the Task Scheduler service (net stop Schedulein an admin command prompt), delete everything insideC:\Windows\System32\Tasks(yes, all of it—Windows rebuilds the built-in tasks on reboot), then restart the service (net start Schedule). Then re-import your custom tasks. This is drastic, but it's saved my ass twice when nothing else worked.
Final note: if you're dealing with a third-party backup tool's exported task, skip the GUI entirely. Open the exported
.xml, look for any<Arguments>that contain paths with spaces but lack quotes around the path. That's the silent killer of imported tasks.
Was this solution helpful?