Barking up the wrong tree
This American expression dating from the 19th century is for any endeavour that has run off course and is therefore a fruitless quest. Its origin stems from hunting with dogs. Raccoons, bears and other hunted prey would shelter in trees. Hunting dogs that were barking up the wrong tree were off the scent. See also on the right/wrong track and wrong end of the stick.