Hi @tm21915. Here is the official online help page for that specific item in question.
https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=OccurrencePatterns_Item
The Item property of the OccurrencePatterns API object will accept either an Integer that represents the index of the item, or a String, representing the name of the item. But if no item can be found with the specified index number or name, then it will throw an error. As suggested before, you may simply have to make sure that the name you are trying to supply there is correct first. Usually something simple like a MsgBox(), or MessageBox.Show(), or Logger.Info() line is sufficient to inform you about what the code has encountered at that point in the code. We may have to see the whole code to be a bit more sure about what the problem might be, if the correct name is being supplied there.
For instance, we can't tell what 'baseNamePattern' or 'currentIndexPattern' represent in your code, because they are not fully defined within that bit of code. And the 'ThisDoc' reference might possibly be pointing to the wrong document, if we were to see the whole code, especially if it was being used within a loop of other referenced documents in a much larger code.
Wesley Crihfield

(Not an Autodesk Employee)