塞翁失馬，焉知非福

Etymology
From a tale in Huai Nan Zi:

Proverb

 * 1) Every cloud has a silver lining. / A setback may turn out to be a blessing in disguise.