An idiom on failure

Scientists believe no experiment is a failure; that even a mistake advances the evolution of understanding.

Unnatural Selection, Star Trek: The Next Generation