Lock failed on JitsiMeetExternalAPI

Whenever I use api.executeCommand(“password”, “abc”); on my self hosted domain, it gives an error saying lock failed, while if I change the domain to meet.jit.si is works perfectly.

1 Like

On your instance the first to join is the moderator, and only that participant can set password. where on meet.jit.si all participants are moderators.

1 Like

Same error for the first participant too, i kept a very random name, and started it, still getting the same error.


got any solution? am facing same issue with self hosted instance.

Are you executing the command after joining the conference?

Yes,am executing the command after joining the conference.

The exact code snippet is:

setTimeout(() =>
api.addEventListener(‘videoConferenceJoined’, (response) => {
api.executeCommand(‘password’, ‘my_password’);
}, 10);

@damencho I’ve face same error as mention by @Arun_Kumar_HG
I’ve setup jitsi-meet using docker and call JitsiMeetExternalAPI

api.addEventListener('videoConferenceJoined', () => {
            console.log('Local User Joined');
            api.executeCommand('displayName', "user_name");
            api.executeCommand('password', 'my_password');

My displayName set successfully but the password is not set, it throws the following error


After dismiss this error jitsi says the "moderator rights granted to AjayB" message and @damencho I’m already the first moderator and participant in this call as you mention in your first replay

Please help to find some solution to this issue, it will replay helpful to me and other developers also

Hi @damencho this is the exact issue am facing (as mentioned by @Ajay_Bodara) . Would like to know on/after which event we are suppose to execute the password command to overcome the “Lock Failed” error.

Also please guide us on how to catch the event triggered for “My role changed, new role: moderator”.


There is no event I think exposed to the iframe api for the role changed. Does setting the password works if you delay it let’s say with 5 or 10 seconds?

hi @damencho, its working with the delay of 15 Sec or so ( again not consistent and it varies) .

Or do we have any mechanism to check if password is set for a conference or not? So as we can prevent other participant from joining the conference till the password is set?

ex: api.isLocked()?


Nope there is no such thing, sorry.

@damencho what about the solution for lock failed? we can’t wait for 15s to apply a password.

1 Like

Hi, same problem here.

@damencho Hello, I have implemented the code that you shared, waiting between 10 to 25 seconds, and I have the error of “Lock failed”, this code:

        setTimeout(() => {
        // why timeout: I got some trouble calling event listeners without setting a timeout 
        // when local user is trying to enter in a locked room 
        api.addEventListener('passwordRequired', () => {
            api.executeCommand('password', '12345678');
        // when local user has joined the video conference 
        api.addEventListener('videoConferenceJoined', (response) => {
            api.executeCommand('password', '12345678');
    }, 15);

Do I need to implement something else?

@damencho Thank you for your answers.
This seems not to be working only on self-hosted Jitsi. When i try to set a room’s password via API on meet.jit.si, this works like a charm.
Using the “set password” API with my self-hosted Jitsi (as it is, without any kind of authentication), i only receive the “lock error”.

What could be the difference between meet.jit.si installation and clean self-hosted one (installed via apt)?

Thank you

From the console output i can see that self hosted Jitsi (tested with 2 different versions, unstable and stable) change the role from moderator to null, than it changes from null to moderator.
I think that the issue is here since, while trying with meet.jit.si, this “double” role change is not present.

2020-04-27T13:09:35.259Z [modules/xmpp/ChatRoom.js] <onPresence>:  entered maarcoio@conference.XX.YY.ZZ/focus 
Object { affiliation: "owner", role: "moderator", jid: "focus@auth.XX.YY.ZZ/focus836087031605087", isFocus: true, isHiddenDomain: false }

2020-04-27T13:09:35.260Z [modules/xmpp/ChatRoom.js] <_initFocus>:  Ignore focus: maarcoio@conference.XX.YY.ZZ/focus, real JID: focus@auth.XX.YY.ZZ/focus836087031605087

2020-04-27T13:09:35.268Z [conference.js] <_setupListeners/<>: My role changed, new role: none

2020-04-27T13:09:35.326Z [features/room-lock] setting password failed Error: "You are not moderator."

2020-04-27T13:09:35.511Z [conference.js] <_setupListeners/<>:  My role changed, new role: moderator

Why is this different from meet.jit.si? How can we change this behaviour?

I’m using BuddyMeet plugin for Wordpress and I get the same error: lock failed. After this warning I get another message that informs me I’m a moderator. This happens when I use my personal Jitsi installation; when I set to use meet.jit.si there is no problem at all. What can I do to solve this issue?

@damencho @bbaldino
Why the role switches two times from moderator to none and vice-versa? Why this happen on all of the self-hosted installs and not on meet.jit.si? Which could be the difference, if we are talking about a non customized and fresh “apt install” installation of Jitsi?

Thank you!

Im having the same issue on my self-hosted install. Fresh install, no modifications. Same code snip works great on meet.jit.si but when we switch to our domain, it isn’t working.