Strange corruption, cannot delete records

I have a baserow table that seems to have some data corruption. There are records that got duplicated somehow and when I try to delete them, they won’t disappear. I get the following in the system logs instead:

[BACKEND][2023-08-16 11:06:16] 172.17.0.1:0 - "DELETE /api/database/rows/table/449/8/ HTTP/1.1" 500                                                                                                [BACKEND][2023-08-16 11:06:17] 127.0.0.1:59600 - "GET /api/_health/ HTTP/1.1" 200                                                                                                                  [BACKEND][2023-08-16 11:06:17] ERROR 2023-08-16 18:06:17,399 django.request.log_response:224- Internal Server Error: /api/database/rows/table/449/8/                                               [BACKEND][2023-08-16 11:06:17] Traceback (most recent call last):                                                                                                                                  [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/asgiref/sync.py", line 486, in thread_handler                                                                     [BACKEND][2023-08-16 11:06:17]     raise exc_info[1]                                                                                                                                               [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 38, in inner
 [BACKEND][2023-08-16 11:06:17]     response = await get_response(request)                                                                                                                          [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 233, in _get_response_async
 [BACKEND][2023-08-16 11:06:17]     response = await wrapped_callback(request, *callback_args, **callback_kwargs)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/asgiref/sync.py", line 448, in __call__
 [BACKEND][2023-08-16 11:06:17]     ret = await asyncio.wait_for(future, timeout=None)
 [BACKEND][2023-08-16 11:06:17]   File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
 [BACKEND][2023-08-16 11:06:17]     return await fut
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/asgiref/current_thread_executor.py", line 22, in run
 [BACKEND][2023-08-16 11:06:17]     result = self.fn(*self.args, **self.kwargs)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/asgiref/sync.py", line 490, in thread_handler
 [BACKEND][2023-08-16 11:06:17]     return func(*args, **kwargs)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
 [BACKEND][2023-08-16 11:06:17]     return view_func(*args, **kwargs)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
 [BACKEND][2023-08-16 11:06:17]     return self.dispatch(request, *args, **kwargs)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
 [BACKEND][2023-08-16 11:06:17]     response = self.handle_exception(exc)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
 [BACKEND][2023-08-16 11:06:17]     self.raise_uncaught_exception(exc)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
 [BACKEND][2023-08-16 11:06:17]     raise exc
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
 [BACKEND][2023-08-16 11:06:17]     response = handler(request, *args, **kwargs)
 [BACKEND][2023-08-16 11:06:17]   File "/usr/lib/python3.9/contextlib.py", line 79, in inner                                                                                                        [BACKEND][2023-08-16 11:06:17]     return func(*args, **kwds)                                                                                                                                      [BACKEND][2023-08-16 11:06:17]   File "/baserow/backend/src/baserow/api/decorators.py", line 107, in func_wrapper
 [BACKEND][2023-08-16 11:06:17]     return func(*args, **kwargs)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/backend/src/baserow/contrib/database/api/rows/views.py", line 868, in delete
 [BACKEND][2023-08-16 11:06:17]     action_type_registry.get_by_type(DeleteRowActionType).do(
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/backend/src/baserow/contrib/database/rows/actions.py", line 311, in do
 [BACKEND][2023-08-16 11:06:17]     RowHandler().delete_row_by_id(user, table, row_id, model=model)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/backend/src/baserow/core/telemetry/utils.py", line 72, in _wrapper
 [BACKEND][2023-08-16 11:06:17]     raise ex
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/backend/src/baserow/core/telemetry/utils.py", line 68, in _wrapper
 [BACKEND][2023-08-16 11:06:17]     result = wrapped_func(*args, **kwargs)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/backend/src/baserow/contrib/database/rows/handler.py", line 1731, in delete_row_by_id
 [BACKEND][2023-08-16 11:06:17]     self.delete_row(user, table, row, model=model)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/backend/src/baserow/core/telemetry/utils.py", line 72, in _wrapper
 [BACKEND][2023-08-16 11:06:17]     raise ex
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/backend/src/baserow/core/telemetry/utils.py", line 68, in _wrapper
 [BACKEND][2023-08-16 11:06:17]     result = wrapped_func(*args, **kwargs)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/backend/src/baserow/contrib/database/rows/handler.py", line 1761, in delete_row
 [BACKEND][2023-08-16 11:06:17]     before_return = before_rows_delete.send(
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 180, in send
 [BACKEND][2023-08-16 11:06:17]     return [
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
 [BACKEND][2023-08-16 11:06:17]     (receiver, receiver(signal=self, sender=sender, **named))
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/backend/src/baserow/contrib/database/ws/rows/signals.py", line 69, in before_rows_delete
 [BACKEND][2023-08-16 11:06:17]     return get_row_serializer_class(model, RowSerializer, is_response=True)(
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/rest_framework/serializers.py", line 768, in data
 [BACKEND][2023-08-16 11:06:17]     ret = super().data
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/rest_framework/serializers.py", line 253, in data
 [BACKEND][2023-08-16 11:06:17]     self._data = self.to_representation(self.instance)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/rest_framework/serializers.py", line 686, in to_representation
 [BACKEND][2023-08-16 11:06:17]     return [
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/rest_framework/serializers.py", line 687, in <listcomp>
 [BACKEND][2023-08-16 11:06:17]     self.child.to_representation(item) for item in iterable
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/rest_framework/serializers.py", line 522, in to_representation
 [BACKEND][2023-08-16 11:06:17]     ret[field.field_name] = field.to_representation(attribute)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/rest_framework/serializers.py", line 686, in to_representation
 [BACKEND][2023-08-16 11:06:17]     return [
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/rest_framework/serializers.py", line 687, in <listcomp>
 [BACKEND][2023-08-16 11:06:17]     self.child.to_representation(item) for item in iterable
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/rest_framework/serializers.py", line 522, in to_representation
 [BACKEND][2023-08-16 11:06:17]     ret[field.field_name] = field.to_representation(attribute)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/venv/lib/python3.9/site-packages/rest_framework/fields.py", line 763, in to_representation
 [BACKEND][2023-08-16 11:06:17]     return str(value)
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/backend/src/baserow/contrib/database/table/models.py", line 796, in __str__
 [BACKEND][2023-08-16 11:06:17]     return field["type"].get_human_readable_value(
 [BACKEND][2023-08-16 11:06:17]   File "/baserow/backend/src/baserow/contrib/database/fields/field_types.py", line 3048, in get_human_readable_value
 [BACKEND][2023-08-16 11:06:17]     return ", ".join(export_value)
 [BACKEND][2023-08-16 11:06:17] TypeError: can only join an iterable

I’ve tried backing up the database and restoring, but the corruption persists. Any suggestions on how I can fix this?

1 Like

Hi @tiz.io can you show us exactly what this row consists of including all fields/formula values etc?

Scratch that i’ve found the bug, we’ll have it fixed for the next release.

This bug is triggered by linking to a primary multi select field, whose cell has no entries. So one workaround for now is to first empty that link to field cell pointing at the table with the multi select primary field and then you will be able to delete that row.