Error 4000 on agent.RunOnServer

I’m having trouble finding the cause of this problem - I’m convinced it’s to do with access rights.

I have a piece of script calling an agent with .RunOnServer. On that line of code I get Error 4000 Unknown LotusScript error. The called agent is signed by an id that is allowed to run restricted LS agents (so my Admins tell me). The trigger is on schedule never and it is set to run on all documents. The runtime security level is 1, Do not allow restricted operations.

To find the cause I tried scheduling the agent to run on the server - that worked fine. But when the same user that signs the agent runs the code on the client that calls RunOnServer the error described above occurs.

I also tried stripping out the code from the called agent. With no code in it the error does not occur. As soon as I restore the first line of code, Dim session as New NoteSession, the error reappears.

Thanks in advance for any hints on what to check / try next.

Subject: Error 4000 on agent.RunOnServer

This problem seemed to disappear after the server was recycled. However,it has occurred again. This time it cleared by simply restarting the client. Very strange!