Never been locked bugNot An Issue
If a lock has never been locked (e.g. codelock has always been green), it will show this error in chat: It is locked... (although lock is green)
The workaround for a green light to let me in is to 1- disable Masterkey or 2- lock for the 1st time and unlock that door/chest.
On what circumastances does it happen? When you're opening a door?
Yes..
I don't believe the issue is with Masterkey, as it does not go further if the lock is not locked. Plus that message you say appears, is not a default message of Masterkey.

Which means something else must be interfering. 
Correct. Unloaded the Vanish plugin. Fixed.
Locked automatically