To reproduce, in a script written on the main wiki, try to delete a version from a document located on a subwiki.
The workaround is to switch the context to the wiki of the target document before calling #deleteDocumentVersions.