Move tab insertion to error formatting function