Unable to load or delete corrupted tasks
search cancel

Unable to load or delete corrupted tasks

book

Article ID: 162337

calendar_today

Updated On:

Products

IT Management Suite

Issue/Introduction

Certain tasks will not load in the console, and the right click menu item will not open. They cannot be deleted by either right clicking on them or by adding them to the "Itemtodelete" table.  

 "Unable to get task details (*task guid*): Unable to load item *task guid* version -1
   
"Unable to delete the specified item (Item: {*task guid*}, Exception: Altiris.TaskManagement.Exceptions.ItemVersionNotFoundException: Unable to load item *task guid* version -1

 

Environment

ITMS 7.x

ITMS 8.x

Cause

This can happen if there are no versions of a tasks. Use the following query to test for this condition. 

select *
  from itemversions
 where itemguid = '*task guid*'

If this query comes back with no results, it means that your task has no versions, and that is why they can't be loaded or deleted. When clicking on a task, it tries to load the most recent version, but there are none to be found. 

 

Resolution

This can be resolved by temporarily giving a task a version so task can be deleted.

1. Create a new task of the same type and modify it a couple times and save changes each time. The name of this task doesn't matter, it will be deleted when this process is done. 

2. Run the following query against CMDB database on your SQL server. This will map a version of your new task, to the corrupted tasks so it can be removed. 

declare @broken as  uniqueidentifier = 'Guid Of Broken Task'
declare @dummy as uniqueidentifier = 'Guid of Newly Created Task'

update ItemVersions
   set itemguid = @broken
 where VersionGuid in (
          select top 1 versionguid
            from ItemVersions
           where ItemGuid = @dummy
       )

insert
  into ItemToDelete
values(@broken, getdate())

insert
  into ItemToDelete
values(@dummy,getdate())

After running the above query, the corrupted task and the new task will be deleted the next time the "NSQuarter-hour" scheduled task run (within the next 15 min) on SMP server.

Please note! There is no way to recover the original task in this instance. 

Additional Information

"Old Tasks will not Delete - no delete option in the right-click menu" (KB 172958 )