I think the reason you are getting this error is because you are using TCL 8.3. The lsearch command in 8.3 doesn't support some of the -all flag (http://www.tcl.tk/man/tcl8.3/TclCmd/lsearch.htm).
The part that in which the code is breaking is when is trying to find the correspondent resource and match it to item's identifierref. A resource can be linked (or referenced) to one of many items.
If you install TCL 8.4 (as mentioned here in the installation instructions for AOLserver, http://openacs.org/doc/openacs-5-0-0/aolserver4.html) it should work just fine. Otherwise, you can modify the code to get all the items that a single resource is referenced to... it shouldn't be hard, but it will take some time.
It does the same for files as well, so upgrading to TCL 8.4 might be the best option.