Report identical errors only once

This is a prototype for #8466