The police set up an ambush and waited for the thief to walk into the trap.
Tips
history
From Cao Zhi's 《野田黄雀行》: 不见篱间雀,见鹞自投罗 - 'haven't you seen the sparrow by the fence, seeing a hawk, throw itself into the net?' The bird-in-a-net metaphor has stuck ever since.
usage
Criminal context is most common (fugitives arrested when they return), but the idiom also fits any situation where someone walks unwittingly or recklessly into danger they created themselves.