Recently I was attempting to import a solution from my production environment into my test environment. The import gave me the non descriptive “An error has occurred”. However when I drilled into the trace file I got the error “OptionSetId cannot be changed“.
The actual error message was
[2012-11-12 13:25:22.113] Process: w3wp |Organization:2da62e20-d180-df11-965b-a4badb330af0 |Thread: 11 |Category: Platform.Metadata |User: 3ee41d69-d180-df11-965b-a4badb330af0 |Level: Error | EntityService.UpdateNoPrivilegeChecks
>EntityService.Update caught exception: Microsoft.Crm.CrmException: OptionSetId cannot be changed. EnumAttributeInfo.AttributeDescription.OptionSetId(4ea89ebc-adba-455f-9ee4-65bb3d37458a) != 877dc0bb-d508-e211-b59f-0800275416cf
This issue is caused by the fact that I had actually created a Picklist field in my test environment and then later on created the same field in my production environment. This caused the field to have different guids in each system.
1. Using SQL Management Studio, find the field that is having problems. Replace the guid with the 2nd guid listed in your error.
select name from optionsetview where optionsetid = ‘877dc0bb-d508-e211-b59f-0800275416cf’
2. Remove the field found above from the test system. Sometimes this involves removing it from Forms and Views and then publishing and then removing the field and publishing.
3. Now import the solution. In my case the solution now imported with no issues.