Waste one's efforts by pursuing the wrong thing or path, as in If you think I can come up with more money, you're barking up the wrong tree. This term comes from the nocturnal pursuit of raccoon-hunting with the aid of dogs. Occasionally a raccoon fools the dogs, which crowd around a tree, barking loudly, not realizing their quarry has taken a different route. [Early 1800s]
Americans have coined entire expressions as well as individual words. At first bark up the wrong tree meant exactly what it said, the bark being that of a hunting dog pointing at the wrong tree. In Americanisms Old and New (1889), John S. Farmer explains, "The Western huntsman found that his prey gradually became more and more wily and cunning in eluding pursuit, and frequently he and his dogs were at fault, supposing they had 'treed' their game when in reality, especially in the case of opossums and squirrels and such-like animals, it had escaped by jumping from the boughs of one tree to another."
But we have found the expression useful even when there are no hunters, trees, or barking dogs involved. In 1832, we encounter it in James Hall's Legends of the West: "It doesn't take a Philadelphia lawyer to tell that the man who serves the master one day, and the enemy six, has just six chances out of seven to go to the devil. You are barking up the wrong tree, Johnson."
Davy Crockett seems to have been fond of the phrase. In the Sketches and Eccentricities of Col. David Crockett, of West Tennessee (1833), we find, "I told him...that he reminded me of the meanest thing on God's earth, an old coon dog, barking up the wrong tree." And A Narrative of the Life of David Crockett, published a year later, contains the sentence, "I began to think I was barking up the wrong tree again." The 1836 story of Colonel Crockett in Texas includes the remark, "Job, little dreaming that he was barking up the wrong tree, shoved along another bottle."
To bark up the wrong tree basically means "to follow an incorrect assumption." Two other related expressions are also American: be all wet (1792) and fire into the wrong flock (1848).