Error Notes error: Unable to open Name and Address Book (%s), due to error '%e'. Locations cannot be used until the problem has been corrected. - in line: 26 - code: 4000

I have a scheduled agent that kopies data from server A to Server B. Both servers are Window servers with Domino version 8.0.2. The agent runs on Server A and generates the following error when a database on Server B is opened:

Notes error: Unable to open Name and Address Book (%s), due to error ‘%e’. Locations cannot be used until the problem has been corrected. - in line: 26 - code: 4000

When I run the agent manually it runs fine. The agent is signed with my username.

Can you help me with this problem?

Subject: Solution found

The problem was caused by the following:The field ‘Trusted servers’ on the serverdocument (tab security) wasn’t filled with the correct servername.

Subject: Seems to happen also when there is a problem in target replica

My target replica had local encryption enabled and it needed a consistency check. The code that tried to replicate generated this error.