It's common computer folklore that cosmic rays cause errors in computer chips. This is not actually true, or at least it is so rare that a cosmic ray actually manages to reach the ground and knock out a bit in a computer chip, that it might not as well happen compared to the far more common occurrence of an alpha particle emitted by ordinary materials causing errors in computer chips.
So it's rather a surprise that the Mars Rover Opportunity suffered a problem because it may have been hit by a cosmic ray. What is even more impressive is that the hardware in the rover could detect such problems. It's a testament to how robust its systems were designed to be.