I recently went to apply a custom SharePoint theme and was presented with the unhelpful error message above.
It turns out that the reason for this error is that SharePoint has encountered an unknown file that it cannot read from in the themes’ directory.
Navigation to your custom theme directory – [Systemdrive]Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATETHEMESyourtheme and delete the rogue file.
In my case it was the windows generated ‘thumbs.db’ thumbnail database in the folder that was causing the problem. If you have used an editor to edit any of your theme files then you may possibly have some temp files in the directory which need deleting.
If like me it was the ‘thumbs.db’ file then be sure to disable thumbnail caching for the folder. To do this click Tools in windows explorer then select Folder Options > View, look for the checkbox entitled ‘Do not cache thumbnails’ and click it.
Hope this helps