"Cannot Complete Action" exception while creating document library in custom site definition

Hello All,

I was facing a weird behavior while creating a document library on my SharePoint site.  I was not able to create document library.

Problem:

When I was click on create link and selecting document library in my custom site definition, following exception is occurred

"Cannot complete this action.

Please try again.   at Microsoft.SharePoint.Library.SPRequestInternalClass.GetSchemaXML(String bstrUrl, String bstrListName, UInt32 sch, Boolean bOnlyViewAttributes, Boolean bExtendedFieldsProperties, ISPDataCallback pXMLCallback) at Microsoft.SharePoint.Library.SPRequest.GetSchemaXML(String bstrUrl, String bstrListName, UInt32 sch, Boolean bOnlyViewAttributes, Boolean bExtendedFieldsProperties, ISPDataCallback pXMLCallback)"


Solution:

I have my custom site definition and in my site definition, in my Onet.xml file I was missing "<DocumentTemplates>" node. I have copied complete node from team site definition (STS) to my Onet.xml file.  Upgraded the solution, recreated site collection and problem is resolved. 

It seems while creating new document library, SharePoint refers site definition.