Unable to update location for mobile users

Hello,

I was trying to update the location for mobile user as shown below.

The action returns 500 error and this is the associated log for the update action.

2021-10-22 08:54:37,598 ERROR Internal Server Error: /a/fmoh-echis/settings/users/commcare/account/20c96dacd3094730b0e80235a3209cca/
Traceback (most recent call last):
File "/home/cchq/www/echis/releases/2021-10-12_19.21/python_env-3.6/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/python_env-3.6/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/python_env-3.6/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/python_env-3.6/lib/python3.6/site-packages/sentry_sdk/integrations/django/views.py", line 67, in sentry_wrapped
_callback
return callback(request, *args, **kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/python_env-3.6/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/hqwebapp/decorators.py", line 70, in _wrapped
return view_func(*args, **kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/python_env-3.6/lib/python3.6/site-packages/django/utils/decorators.py", line 45, in _wrapper
return bound_method(*args, **kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/domain/decorators.py", line 117, in _inner
return call_view()
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/domain/decorators.py", line 87, in call_view
def call_view(): return view_func(req, domain_name, *args, **kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/users/decorators.py", line 44, in _inner
return view_func(request, domain, *args, **kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/users/views/mobile/users.py", line 175, in dispatch
return super(EditCommCareUserView, self).dispatch(request, *args, **kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/python_env-3.6/lib/python3.6/site-packages/django/utils/decorators.py", line 45, in _wrapper
return bound_method(*args, **kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/domain/decorators.py", line 117, in _inner
return call_view()
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/domain/decorators.py", line 87, in call_view
def call_view(): return view_func(req, domain_name, *args, **kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/domain/decorators.py", line 192, in dispatch
return super(LoginAndDomainMixin, self).dispatch(*args, **kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/python_env-3.6/lib/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/users/views/mobile/users.py", line 362, in post
return super(EditCommCareUserView, self).post(request, *args, **kwargs) [17/1964]
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/users/views/init.py", line 343, in post
self.commtrack_form.save(self.editable_user)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/users/forms.py", line 1007, in save
location_updates = self._update_location_data(user)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/users/forms.py", line 1024, in _update_location_data
user.set_location(SQLLocation.objects.get(location_id=new_location_id))
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/users/models.py", line 2043, in set_location
self.create_location_delegates([location])
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/users/models.py", line 2201, in create_location_delegates
self.clear_location_delegates()
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/apps/users/models.py", line 2194, in clear_location_delegates
safe_hard_delete(mapping)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/ex-submodules/casexml/apps/case/cleanup.py", line 88, in safe_hard_delete
case_updates = get_case_updates(form)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/ex-submodules/casexml/apps/case/xform.py", line 388, in get_case_updates
[case_update_from_block(cb) for cb in extract_case_blocks(xform)],
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/ex-submodules/casexml/apps/case/xform.py", line 343, in extract_case_blocks
form = doc.form_data
File "/home/cchq/www/echis/releases/2021-10-12_19.21/python_env-3.6/lib/python3.6/site-packages/memoized.py", line 20, in _memoized
cache[key] = value = fn(*args, **kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/form_processor/models.py", line 496, in form_data
xml = self.get_xml()
File "/home/cchq/www/echis/releases/2021-10-12_19.21/python_env-3.6/lib/python3.6/site-packages/memoized.py", line 20, in _memoized
cache[key] = value = fn(*args, **kwargs)
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/form_processor/models.py", line 562, in get_xml
return self.get_attachment('form.xml')
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/form_processor/models.py", line 302, in get_attachment
return content.read()
File "/home/cchq/www/echis/releases/2021-10-12_19.21/corehq/blobs/util.py", line 215, in read
return self._obj.read(*args, **kw)
File "/usr/lib/python3.6/gzip.py", line 276, in read
return self._buffer.read(size)
File "/usr/lib/python3.6/gzip.py", line 471, in read
uncompress = self._decompressor.decompress(buf, size)
zlib.error: Error -3 while decompressing data: invalid bit length repeat