Thanks for sending the SDF file.
Is it possible that you have deleted or renamed the flag "1841 Census" in your TMG project?
When the Custom Index Definition window is open for the 1841 Census index, is there a valid TMG flag field selected in the "Flag:" pull-down menu? If not, you can probably correct the problem by selecting a valid entry in that list.
If I am right about the cause of the problem, it indicates a bug in SS. It should not fail with the "out of range" error message but should instead handle the issue more gracefully. I'll look into that.