Spawner crashing the hub

Bug description

Send a string in user_options with start server api call and the hub crashes after a restart

Logs

chart version 2.0.0

hub Loading /usr/local/etc/jupyterhub/secret/values.yaml
hub No config at /usr/local/etc/jupyterhub/existing-secret/values.yaml
hub Loading extra config: lifecycle_hooks
hub Loading extra config: tornado_cors_settings
hub [I 2022-09-20 18:40:59.732 JupyterHub app:2775] Running JupyterHub version 3.0.0
hub [I 2022-09-20 18:40:59.732 JupyterHub app:2805] Using Authenticator: nullauthenticator.NullAuthenticator-1.0.0
hub [I 2022-09-20 18:40:59.732 JupyterHub app:2805] Using Spawner: kubespawner.spawner.KubeSpawner-4.2.0
hub [I 2022-09-20 18:40:59.732 JupyterHub app:2805] Using Proxy: jupyterhub.proxy.ConfigurableHTTPProxy-3.0.0
hub [I 2022-09-20 18:40:59.821 JupyterHub app:1934] Not using allowed_users. Any authenticated user will be allowed.
hub Exception in callback JupyterHub.initialize.<locals>.log_init_time(<Task finishe...v_test"}\'.')>) at /usr/local/lib/python3.9/site-packages/jupyterhub/app.py:2840
hub handle: <Handle JupyterHub.initialize.<locals>.log_init_time(<Task finishe...v_test"}\'.')>) at /usr/local/lib/python3.9/site-packages/jupyterhub/app.py:2840>
hub Traceback (most recent call last):
hub   File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
hub     self._context.run(self._callback, *self._args)
hub   File "/usr/local/lib/python3.9/site-packages/jupyterhub/app.py", line 2841, in log_init_time
hub     n_spawners = f.result()
hub   File "/usr/local/lib/python3.9/site-packages/jupyterhub/app.py", line 2543, in init_spawners
hub     spawner = user.spawners[orm_spawner.name]
hub   File "/usr/local/lib/python3.9/site-packages/jupyterhub/user.py", line 247, in __getitem__
hub     self[key] = self.spawner_factory(key)
hub   File "/usr/local/lib/python3.9/site-packages/jupyterhub/user.py", line 477, in _new_spawner
hub     spawner = spawner_class(**spawn_kwargs)
hub   File "/usr/local/lib/python3.9/site-packages/kubespawner/spawner.py", line 149, in __init__
hub     super().__init__(*args, **kwargs)
hub   File "/usr/local/lib/python3.9/site-packages/traitlets/config/configurable.py", line 85, in __init__
hub     super().__init__(**kwargs)
hub   File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 1235, in __init__
hub     setattr(self, key, value)
hub   File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 715, in __set__
hub     self.set(obj, value)
hub   File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 689, in set
hub     new_value = self._validate(obj, value)
hub   File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 721, in _validate
hub     value = self.validate(obj, value)  # type:ignore[attr-defined]
hub   File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 3183, in validate
hub     value = super().validate(obj, value)
hub   File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 2032, in validate
hub     self.error(obj, value)
hub   File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 827, in error
hub     raise TraitError(e)
hub traitlets.traitlets.TraitError: The 'user_options' trait of a KubeSpawner instance expected a dict, not the str '{username:"user1"}'.
hub [E 2022-09-20 18:40:59.892 JupyterHub app:3297]
hub     Traceback (most recent call last):
hub       File "/usr/local/lib/python3.9/site-packages/jupyterhub/app.py", line 3294, in launch_instance_async
hub         await self.initialize(argv)
hub       File "/usr/local/lib/python3.9/site-packages/jupyterhub/app.py", line 2856, in initialize
hub         await gen.with_timeout(
hub       File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
hub         self._context.run(self._callback, *self._args)
hub       File "/usr/local/lib/python3.9/site-packages/jupyterhub/app.py", line 2841, in log_init_time
hub         n_spawners = f.result()
hub       File "/usr/local/lib/python3.9/site-packages/jupyterhub/app.py", line 2543, in init_spawners
hub         spawner = user.spawners[orm_spawner.name]
hub       File "/usr/local/lib/python3.9/site-packages/jupyterhub/user.py", line 247, in __getitem__
hub         self[key] = self.spawner_factory(key)
hub       File "/usr/local/lib/python3.9/site-packages/jupyterhub/user.py", line 477, in _new_spawner
hub         spawner = spawner_class(**spawn_kwargs)
hub       File "/usr/local/lib/python3.9/site-packages/kubespawner/spawner.py", line 149, in __init__
hub         super().__init__(*args, **kwargs)
hub       File "/usr/local/lib/python3.9/site-packages/traitlets/config/configurable.py", line 85, in __init__
hub         super().__init__(**kwargs)
hub       File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 1235, in __init__
hub         setattr(self, key, value)
hub       File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 715, in __set__
hub         self.set(obj, value)
hub       File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 689, in set
hub         new_value = self._validate(obj, value)
hub       File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 721, in _validate
hub         value = self.validate(obj, value)  # type:ignore[attr-defined]
hub       File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 3183, in validate
hub         value = super().validate(obj, value)
hub       File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 2032, in validate
hub         self.error(obj, value)
hub       File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 827, in error
hub         raise TraitError(e)
hub     traitlets.traitlets.TraitError: The 'user_options' trait of a KubeSpawner instance expected a dict, not the str '{username:"user1"}'.
hub

Have you tried following the suggestion in the error message, and passing a dictionary instead of a string?

If you’re still stuck please could you provide enough information for someone to reproduce your problem? See Getting good answers to your questions for a guide