Couldn't open note: Error opening note unable to resolve the referenced notes

We have a problem with approx. 2000 databases on a Domino Server running 6.5. We are not able to create a local replica from none of these databases. Each try is aborted with the error ““Error 4005: Notes error: Error opening note unable to resolve the referenced note”. We are using single-copy-template on all databases.

Further investigation showed, that in every database a “Replication Formula” document exists, which is not visible in the GUI (via Replication – Settings – Advanced). It is visible in NotesPeek but cannot be opened, generating the error: “Couldn’t open note: Error opening note unable to resolve the referenced notes”.

SCREENSHOT: http://www.konfabulieren.com/pix/notespeek.JPG

The document is also not accessable via LotusScript. The following code:

Set nc = db.CreateNoteCollection(False)

nc.SelectDocuments = False

nc.SelectReplicationFormulas = True

Call nc.BuildCollection

returns – amongst other things – the NoteID of the document (in other words of the replication formula), “Set doc = db.GetDocumentByID(nid)”, but not the document (but “nothing”).

Our try to delete the document via:

convertID = Clng(Val(“&H” & nid)) And &H7FFFFFFF

result = NSFNoteDelete( hDB, convertid, UPDATE_NOSTUB or UPDATE_FORCE)

results in the errormessage “Error 17412: Entry not found in index”.

We also tried to replace the designtemplate, and of course to compact and fixup, but have been unsuccessfully so far. The only thing that seems to work is to create a replica on a different server – which is not really an option considering the amount of databases.

Our question to all guru’s out there: Where does this “$NoteReference” point to (respectively is ?type29? even valid?) and how can we get rid of this “document” (this replication formula)???

Subject: Warning: Val is not all is says it is (and then again, it is)

Please note that Val can only handle 4 digit hex numbers, and that numbers between 8000 and FFFF are considered negative. I’ve been playing with a shredding function too and got bitten by this problem with approx. the same error message. By RTFM I found this little nugget (which upon testing showed the problem for noteid 0x8062):

Note: If the string being evaluated is a hexidecimal number between 8000 and FFFF, both the prefix (&H) and suffix (&) must be used. Hexidecimal numbers between 0 and 7FFF may use just the prefix (&H) or both the prefix (&H) and suffix (&).