This is a bug with 2012R2 and gMSA’s, using imported or existing tasks that have been changed to use the gMSA. The SID of the MS account is never created for the task upon re-registration.
You’ll need to create the SID key.
Note: Resolution is unsupported (or upgrade your OS where this is no longer an issue).
The CredWom key needs to be taken ownership to apply the SID key. You can/should change the ownership back afterwards
HKLM\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Schedule\CredWom\<SID of the gMSA account>
Value: Count (REG_DWORD), Index(REG_SZ)
This will then successfully run the imported/changed task.