While performing an update to some code originally written for CRM 3.0 which I was upgrading to 4.0 and using the new 2007 version of the web services, I found myself getting an unusual error during one of the callouts. The code created a new custom entity from the data in an existing entity. This code was orginally written by another party and I"m not sure why they didn't use the mapping features in CRM to do this but it was coded manually.
The entity with typecode '8' was not found in the Metadata Cache.
Never having seen this before it of course took a lot of time digging through the event viewer and trace logs to find the source of the error. In this case, it came down to one line:
newEntity.OwnerId = originalEntity.OwnerId
In a nutshell: the 'type' attribute on the originalEntity which had just been read out of CRM using the web services was '8', however when creating/setting the type on create the attribute field needs to be the name of the entity. In this case, since the owner was a system user, the type field needed to be set to 'systemuser'
One would think that the inbound and outbound values could be the same or possible set up to parse for both a type code of or the type name.....
Anyway, if someone else comes across this or a similar problem, I hope this helps.