Accidentally caged dwarfs
I just had an encounter with some goblin ambushers in front of my fort. Most were caught by cage traps, and I sent my troops out to finish the rest. However, somehow, two dwarves were captured, and now they're sitting in their "dwarf cages" in animal storage.
How the heck do I get them out? How did they get in there in the first place - I thought my dwarves were immune to their own traps.
You'll have to "build" the traps that the dwarfs are in and then change the assignment so they are let out. It's the same way you handle caged animals and invaders.
The reason the dwarfs get caught is that they either get knocked unconscious, or they are sleeping. Check to see if the dwarf is wounded.