Wednesday, November 16, 2011

SharePoint 2010 - How to deactivate and delete a sandbox solution (site template) that throws exception from UI?


How to deactivate and delete a sandbox solution (site template) that throws exception from UI?


Created a SharePoint 2010 team site (web) and saved it as a site template.
Created a new site using the newly created site template.
Delete the site with which the site template was created.

Attempted to deactivate the site template and it fails with the below exception:

Unable to access web scoped feature (Id: GUID) because it references a non-existent or broken web (Id: GUID) on site 'url'.  Exception: System.ArgumentException: Value does not fall within the expected range. 
   at Microsoft.SharePoint.SPWebCollection.get_Item(Guid id)
   at Microsoft.SharePoint.SPFeatureEnumeratorBase.GetCachedWeb(SPSite site, Guid  webId, Guid featureId)


The reason why I am unable to delete the sandbox solution is because of a missing web (from the above error).
So I tried to restore the deleted site from recycle bin and then tried to deactivate the site template solution. It still did not work.

After some trials and errors, research I noticed that after deleting the deleted sites permanently from recycle bin, I was able to deactivate and delete the solution.

Navigate to Site Actions > Site Settings > Recycle Bin under Site Collection Administration

Click on the link "Deleted from end user Recycle Bin". Find the site that was used to create the site template and delete it.

The site template sandbox solution can now be deactivated and deleted.


  1. Thanks a lot for that Chaitu. I have been looking for a solution to this issue for a couple of days.

  2. Thank you for the tip. Saved lots of time and research!

  3. Thank you so much for your solution! :)

  4. thank you very much

  5. Thank you very much for the solution... keep up the good work.

  6. Worked for me. Thanks.

  7. Bump! Thank you, this worked. I read other postings from other sites and what they said did not solve my problem (don't delete the site you created with the site template WSP).

  8. Worked like a charm!!!