[by mistake] {adv. phr.} As the result of a mistake; through error.
He picked up the wrong hat by mistake.