What it means
If you're barking up the wrong tree, you've got the blame, the theory, or the whole big detective speech pointed at the wrong place. You're making noise, chasing hard, feeling very sure of yourself, and still missing where the real answer actually is.
Usage examples
"The police were barking up the wrong tree for weeks before they realised the real culprit was the one who reported it."
"You are barking up the wrong tree blaming the wifi, the whole street lost power, that is why nothing works."
"If you think I ate the last slice, you are barking up the wrong tree, I have been out all afternoon."
"Mate, you're barking up the wrong tree if you think Jess leaked the group chat. She wasn't even there."
"Nah, the boss is barking up the wrong tree blaming the interns. The numbers were cooked way before they touched the file."
Where it comes from
This one comes from American hunting talk in the early 1800s. A dog would chase an animal up a tree and start kicking off at the trunk, dead convinced it had the right spot. Problem was, the critter might've already slipped off elsewhere, so all that noise was aimed at nothing.
Other ways to say it
This expression also appears in