BUG: Fix unbound local in exception handling in core/index

Only would occur if both enumerations failed. better way to handle than
try/except.