Cannot find external name

We have a custom “GetDocByKey” function in a script library that is called from a WQO agent.

Every now and again, we get “Cannot find external name”

We recompiled the database on the server but are still getting the error intermittently

Can anyone give any suggestions for a solution?

TIA

Mike