He thought the boss was annoyed because he hadn’t finished the project yet, but he was barking up the wrong tree.
She thinks I can get her the job, but I’m afraid she’s barking up the wrong tree.
You’re barking up the wrong tree if you think putting the customer under pressure will achieve anything.
To be barking up the wrong tree means to be mistaken about the reason for something or to be wrong about the way to achieve something.
The expression originates from the idea of a dog barking at the bottom of a tree, while the animal it is chasing (perhaps a squirrel) is actually in another tree.
German: auf dem falschen Dampfer sein, auf dem Holzweg sein