ERROR: Invalid index on empty tuple