ivy: flush input on error

Change-Id: I09a4c98c9d21ae3686fcb76abe0c2ae0bd058269