Errors that could be shown in SharePoint when installing or activating a feature "An unexpected error has occurred", "Failed to compare two elements in the array" or various other error messages may be shown while activating, deactivating, or browsing to a recently failed deployment of a WSP solution .
To check or remove invalid features on SharePoint 2007 site:
Here is a snippet of Scott's Blog for more information:
The usual reason for this problem is that some sites in the site collection have features assigned where the feature is not installed in the server farm. The main problem here is that you cannot easily identify which features are missing as the missing features are not reported in the error message.
To overcome this problem I have written a tool which allows to identify all features used in a site collection which are missing on the server: WssAnalyzeFeatures.
To resolve the problem you then have to install the identified missing features on the exporting server. In case that this is not possible you have to remove the features from the site collection or the affected sites. Usually this can be done using STSADM -o deactivatefeature but sometimes fails if the feature definition is not installed on the server. In this case you can use WssRemoveFeatureFromSite.