 Barking up the wrong trees is an expression that means pursuing the wrong course of action. This began in hunting in America in the 19th century. Men would go raccoon hunting at night, the raccoon being a nocturnal animal, and dogs would be used to track them. And in the panic to escape, the raccoons would often run up trees.