bark up the wrong tree

Meaning 1
the dog is not barking at the animal the hunter wants
Sentence 1
Jim's dog didn't tree the racoon. The racoom jumped to another tree and the dog barked up the wrong tree.
Meaning 2
to make a wrong choice
Sentence 2
The FBI agent didn't find the criminal. He was barking up the wrong tree.