Thru a series of unfortunate events (most likely missing a template in a package between servers/instances) I found myself having issues inserting links thru the General Link field. Tracked it down to an item in the content tree that had an item with no defined Template:

enter image description here

This makes it hard to edit, change template or even delete the item. I have tried a few different ways to resolve the issue including using Sitecore Powershell Extensions which I have had good luck with corrupted items, but unfortunately this time it did not; Null Object Reference while trying to execute a script that would just set it to a very basic template:

$badItem = Get-Item "master:/sitecore/content/Site/Home/JobTagDetails"
$baseTemplateItem= Get-Item "/sitecore/templates/System/Item"
Set-ItemTemplate -Item $badItem -Template $baseTemplateItem

Which I can only assume is because of the null value on the item template value even within Sitecore Powershell Extensions. Is there any other ways to delete a corrupted Item (particularly one that lacks a defined template)? I considered serializing the tree to server, grabbing the directory, omitting the corrupted and updating the tree from serialized values but that seems like (and maybe will as a last stitch effort) a very aggressive way to resolve the issue.

  • Have you tried making the change with an event disabler wrapper around the commands? I often have to do that. Commented Dec 14, 2017 at 22:28
  • @MichaelWest by event disabler, are you talking about within SPE or something else?
    – vandsh
    Commented Dec 14, 2017 at 22:44
  • 1
    Check out this answer sitecore.stackexchange.com/a/1173/95. Commented Dec 14, 2017 at 22:46
  • Thanks @MichaelWest I will have to keep that in mind next time, I was not aware of that.
    – vandsh
    Commented Dec 14, 2017 at 22:47
  • Fixed Set-ItemTemplate with this issue github.com/SitecorePowerShell/Console/issues/1138. Commented Sep 14, 2019 at 4:04

2 Answers 2


A safer method would be to use the DbBrowser. You can find this by going to <yoursiteurl>/sitecore/admin/dbbrowser.aspx. You will get a screen where the content tree loads up on the left and you get a raw view of fields on the right:


This screen does not run any of the validation elements from the main content editor. It just browses the database items. From here you can delete the offending item very easily without having to directly access the database.

Because this hits the DB directly and does not go through the normal pipelines, rebuilding indexes and clearing cache should be done once the update is complete.

  • 2
    Thanks @RichardSeal this would have been not only safer but probably easier than firing up SSMS, I forgot about the dbbrowser.aspx
    – vandsh
    Commented Dec 14, 2017 at 22:45

In a less than elegant route, I was able to resolve the issue.

I packaged up the content tree and installed it locally. From there I went into the database and found the culprit Item:

SELECT *  FROM [master].[dbo].[Items] where ID = '{3D6EF992-4FA8-4F88-8E9D-9B06310A1AC0}'

and grabbed the TemplateID value that was returned from the query. I ran a second query similar to the one above but instead with the returned TemplateID just to verify that the Item did indeed not exist, which it didn't. I then grabbed the ID for the /sitecore/templates/System/Item item ({B174990B-37B1-4A60-9C7D-891B521E1B76}) and wrote an Update query:

  Update [master].[dbo].[Items] Set TemplateID = '{B174990B-37B1-4A60-9C7D-891B521E1B76}' 
      WHERE ID = '{3D6EF992-4FA8-4F88-8E9D-9B06310A1AC0}'

Now that the value in the database is correct, I did an index rebuild on the ndxTemplateID and then did an IISreset in order to clear the app, but I assume hitting the /sitecore/admin/cache.aspx page would have done just the same. The last thing I did then was, on my local, create a package with just the updated item, installed it on the target server and then promptly deleted the item which was the original intention. Hope this helps someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.