Error setting datastore variable

I’m having trouble setting a datastore key/value. I’m logged into the st2client pod as st2admin and am doing the following:

st2 key set foo boo

and getting this error:

ERROR: 400 Client Error: Bad Request
MESSAGE: Extra data: line 1 column 5 - line 2 column 1 (char 4 - 19) for url: http://stackstorm-st2api:9101/keys/foo

Am I doing something that is obviously wrong?

Looking at logs, it seems to be throwing the following exception:

2021-01-04 19:22:15,825 INFO [-] abc5b97e-6ae8-4bf1-8303-50da40b79cfd - PUT /keys/foo with query={} (method=‘PUT’,path=’/keys/foo’,remote_addr=‘192.168.45.255’,query={},request_id=‘abc5b97e-6ae8-4bf1-8303-50da40b79cfd’)
2021-01-04 19:22:15,832 ERROR [-] Failed to call controller function “put” for operation “st2api.controllers.v1.keyvalue:key_value_pair_controller.put”: Extra data: line 1 column 5 - line 2 column 1 (char 4 - 19)
Traceback (most recent call last):
File “/opt/stackstorm/st2/lib/python3.6/site-packages/st2common/router.py”, line 516, in call
resp = func(**kw)
File “/opt/stackstorm/st2/lib/python3.6/site-packages/st2api/controllers/v1/keyvalue.py”, line 292, in put
with self._coordinator.get_lock(lock_name):
File “/opt/stackstorm/st2/lib/python3.6/site-packages/tooz/locking.py”, line 52, in enter
acquired = self.acquire(*args, **kwargs)
File “/opt/stackstorm/st2/lib/python3.6/site-packages/tooz/drivers/etcd.py”, line 132, in acquire
“prevExist”: “false”})
File “/opt/stackstorm/st2/lib/python3.6/site-packages/tooz/drivers/etcd.py”, line 75, in put
return self.session.put(url, **kwargs).json()
File “/opt/stackstorm/st2/lib/python3.6/site-packages/requests/models.py”, line 898, in json
return complexjson.loads(self.text, **kwargs)
File “/opt/stackstorm/st2/lib/python3.6/site-packages/simplejson/init.py”, line 525, in loads
return _default_decoder.decode(s)
File “/opt/stackstorm/st2/lib/python3.6/site-packages/simplejson/decoder.py”, line 373, in decode
raise JSONDecodeError(“Extra data”, s, end, len(s))
simplejson.errors.JSONDecodeError: Extra data: line 1 column 5 - line 2 column 1 (char 4 - 19)
2021-01-04 19:22:15,833 INFO [-] abc5b97e-6ae8-4bf1-8303-50da40b79cfd - 400 84 8.372ms (method=‘PUT’,path=’/keys/foo’,remote_addr=‘192.168.45.255’,status=400,runtime=8.372,content_length=84,request_id=‘abc5b97e-6ae8-4bf1-8303-50da40b79cfd’)

Confirming it’s a bug specific to stackstorm-ha K8s/Helm environment.
Thanks for reporting it in Can't set datastore key/value pairs in 0.50.0 · Issue #167 · StackStorm/stackstorm-ha · GitHub.
Let’s track it there.