Dear Sir,
I am glad that I have helped you.
This error with the XOAI import happened also to our installation a few years ago and sometimes it happens because it tries to index in OAI an item from the SOLR index that does not have a handle number. This happens when an item with no handle number has been indexed in SOLR, which should not occur.
This might not happen for an ordinary item, but it may occur for an Item Template that is specified for a collection, but it is withdrawn (which should NOT happen).
You should check all your withdrawn items in DSpace and if you find one or more that are not ordinary items, but Item Templates, then you should delete and recreate them for the collection(s) they belong to. Make sure to keep the pre-filled data, so that you will be able to re-create them.
One query you could run in your postgres, in order to see which items in general do not have a handle number is:
SELECT * FROM item WHERE NOT EXISTS (SELECT resource_id FROM handle WHERE handle.resource_id = item.uuid AND handle.resource_type_id = 2);
The query will respond with a number of items with no handle number. For most of the items is normal, since they might be incomplete submissions from users, or submissions which have not completed the workflow, etc. You will also see item templates in that list. They also do not have handle numbers and it is normal.
However, check the "withdrawn" column for everyone of these items and to see if it is "t" (true) and for these items check if they are item templates. You can do that by pasting the uuid in the "internal ID" of the administrative interface of DSpace in "Content->Items" If that is the case, then you must delete them and recreate them for the collection they belong to, but this time they must not be withdrawn. When you recreate them, before you run the OAI index script, you will have to recreate the SOLR index with
/dspace/bin/index-discovery -b -f so that the erroneous item will be excluded from the index (the -b deletes the index and the -f forces each item to be re-indexed, so make sure that your reindexing process works well, or have a backup of the index before attempting this necessary step, or you might end up with no search index if it also crashes).
If that does not solve the problem, then another item with no handle number might be the culprit, ordinary or Item template, which mistakenly has been indexed in SOLR.
In case you would like to dive into SOLR, there is this query that can be run directly to SOLR from the console of your Linux server, which will return all indexed documents in SOLR that do not have a handle number. However, the returned file is an XML JSON file, but I guess it will provide enough information about these erroneous items and then you can spot them. The query is (keep the single and double quotes, or the shell might not ran the command).:
I hope this also helps you
Best Regards,
-Fk