Spotlight generating an OutOfBounds exception

Done a bit of Googling but can’t find the answer, is there any reason why as to why the Spotlight function in Xojo would fail with an OutOfBounds exception?

The code in question is below and it fails on the first and every single item after :frowning:

query = New SpotlightQuery( "kMDItemFSName == '" + nameWithoutExtension + "*'" + _ " && kMDItemContentTypeTree == ""public.image""" ) query.Synchronous = True query.Run

Yeah it was working fine last week, then I had a meltdown and had to re-install the macOS. I don’t know how many pictures, but its 79GB.