handle IndexError exception it value_by_tag function