Not a bug, but a strange situation.
If the character does not learn the "Locks and Bolts" skill, then by installing the existing lock (for example, found or received from another player), he will not receive the key.
On the one hand, it is logical. But on the other hand - not very much.
When I was killed, I started the game as an heir and decided to install an existing lock on one of the doors of the palisade, which had not previously been locked. And ... I could not get out :\
I was lucky that in my territory there were materials for the Wrecking Ball. Otherwise, I would have to break the Hearth Fire and throw the dwelling.