Enable sharing jupyter server: scope 'shares!user' for role user does not exist

Hi,
I am trying to give users the ability to share their servers with other users.
They are managed via LDAP.
Following the documentation at Sharing access to user servers — JupyterHub documentation

I set the following in jupyterhub_config.py:

c.JupyterHub.load_roles = [
    {
        "name": "user",
        "scopes": ["self", "shares!user"],
    },
]

However, when I deploy the stack on my swarm I get:

# docker stack deploy -c docker-compose.yaml jupyter
Creating service jupyter_jupyterhub
# docker service logs -f jupyter_jupyterhub
jupyter_jupyterhub.1.v6aeoheytsqo@www    | [I 2024-03-04 15:16:10.035 JupyterHub app:2859] Running JupyterHub version 4.0.2
jupyter_jupyterhub.1.v6aeoheytsqo@www    | [I 2024-03-04 15:16:10.035 JupyterHub app:2889] Using Authenticator: ldapauthenticator.ldapauthenticator.LDAPAuthenticator-1.3.2
jupyter_jupyterhub.1.v6aeoheytsqo@www    | [I 2024-03-04 15:16:10.035 JupyterHub app:2889] Using Spawner: builtins.CustomSwarmSpawner
jupyter_jupyterhub.1.v6aeoheytsqo@www    | [I 2024-03-04 15:16:10.035 JupyterHub app:2889] Using Proxy: jupyterhub.proxy.ConfigurableHTTPProxy-4.0.2
jupyter_jupyterhub.1.v6aeoheytsqo@www    | [I 2024-03-04 15:16:10.179 JupyterHub app:1709] Writing cookie_secret to /srv/jupyterhub/jupyterhub_cookie_secret
jupyter_jupyterhub.1.v6aeoheytsqo@www    | [I 2024-03-04 15:16:10.265 alembic.runtime.migration migration:213] Context impl SQLiteImpl.
jupyter_jupyterhub.1.v6aeoheytsqo@www    | [I 2024-03-04 15:16:10.265 alembic.runtime.migration migration:216] Will assume non-transactional DDL.
jupyter_jupyterhub.1.v6aeoheytsqo@www    | [I 2024-03-04 15:16:10.273 alembic.runtime.migration migration:621] Running stamp_revision  -> 0eee8c825d24
jupyter_jupyterhub.1.v6aeoheytsqo@www    | [I 2024-03-04 15:16:10.339 JupyterHub proxy:556] Generating new CONFIGPROXY_AUTH_TOKEN
jupyter_jupyterhub.1.v6aeoheytsqo@www    | [E 2024-03-04 15:16:10.354 JupyterHub app:3382]
jupyter_jupyterhub.1.v6aeoheytsqo@www    |     Traceback (most recent call last):
jupyter_jupyterhub.1.v6aeoheytsqo@www    |       File "/usr/local/lib/python3.10/dist-packages/jupyterhub/app.py", line 3379, in launch_instance_async
jupyter_jupyterhub.1.v6aeoheytsqo@www    |         await self.initialize(argv)
jupyter_jupyterhub.1.v6aeoheytsqo@www    |       File "/usr/local/lib/python3.10/dist-packages/jupyterhub/app.py", line 2905, in initialize
jupyter_jupyterhub.1.v6aeoheytsqo@www    |         await self.init_role_creation()
jupyter_jupyterhub.1.v6aeoheytsqo@www    |       File "/usr/local/lib/python3.10/dist-packages/jupyterhub/app.py", line 2158, in init_role_creation
jupyter_jupyterhub.1.v6aeoheytsqo@www    |         roles.create_role(self.db, role)
jupyter_jupyterhub.1.v6aeoheytsqo@www    |       File "/usr/local/lib/python3.10/dist-packages/jupyterhub/roles.py", line 164, in create_role
jupyter_jupyterhub.1.v6aeoheytsqo@www    |         _check_scopes_exist(scopes, who_for=f"role {role_dict['name']}")
jupyter_jupyterhub.1.v6aeoheytsqo@www    |       File "/usr/local/lib/python3.10/dist-packages/jupyterhub/scopes.py", line 726, in _check_scopes_exist
jupyter_jupyterhub.1.v6aeoheytsqo@www    |         raise KeyError(f"Scope '{scope}' {log_for} does not exist")
jupyter_jupyterhub.1.v6aeoheytsqo@www    |     KeyError: "Scope 'shares!user' for role user does not exist"

sharing permissions requires JupyterHub 5, which is not yet released. Are you running from HEAD?

Thanks for your answer, yes I saw that info 2 days ago. I use the docker image and the latest is 4.0.2 so I guess I will have to wait …