Error message opening document from script

Hello, All,

I am iterating through all the documents in the project using

foreach my \$key (keys %Documents) {

    my \$doc = \$Documents{\$key};

    etc etc

At some point I get the error message

The document does not contain a trajectory (function/property "Item") at -e line 11.

which refers to the my \$doc = \$Documents{\$key};

Presumably this is trying to open a corrupted trajectory file. Is there any way to identify which file it is? I cannot get the name of it from \$doc->Name. I know that the key is {9921A4EF-1900-49FD-965D-A8D6F8604CC2}. Is there a way to identify the document file from that?

thanks,

gf