better error messages for unexpected inputs/outputs during conversion