mir: improve error logging