I see that I reversed the arguments in
Base.iterate(I::CustomIndexSet) = 1,CustomIndex(1)
I got confused by the description in the manual of iterate:
Returns either a tuple of the first item and initial state or
nothingif empty
“Item” and “state” seem interchangeable and ambiguous.