Skip to content

QGIS plugin fails to download project due to malformed SQLite database #255

Description

@xkello

Description

In the QGIS plugin, a project cannot be downloaded in the production environment.

The issue happens during the project download finalization step. Based on the available log, the failure occurs while the plugin is trying to create a SQLite copy as part of the download process. The operation fails with a GeoDiff error indicating that the database disk image is malformed.

Environment

PROD

Current behavior

The project download fails in the QGIS plugin.

The available log contains a Python traceback from the download finalization flow, ending with a GeoDiff make_copy_sqlite failure caused by a malformed SQLite database.

Expected behavior

The QGIS plugin should download the project successfully, or provide a clear and actionable error message if the project contains a malformed or unreadable database file.

Additional information

  • Full logs can be provided by me: @xkello.
  • The related Odoo ticket can also be provided if needed.

Stacktrace

Traceback (most recent call last):

  File "/Users/<user>/Library/Application Support/QGIS/QGIS3/profiles/keychainone/python/plugins/Mergin/sync_dialog.py", line 151, in download_timer_tick
    download_project_finalize(self.job)

  File "/Users/<user>/Library/Application Support/QGIS/QGIS3/profiles/keychainone/python/plugins/Mergin/mergin/client_pull.py", line 247, in download_project_finalize
    task.apply(job.mp.dir, job.mp)

  File "/Users/<user>/Library/Application Support/QGIS/QGIS3/profiles/keychainone/python/plugins/Mergin/mergin/client_pull.py", line 302, in apply
    mp.geodiff.make_copy_sqlite(mp.fpath(self.file_path), mp.fpath_meta(self.file_path))

  File "/Users/<user>/Library/Application Support/QGIS/QGIS3/profiles/keychainone/python/plugins/Mergin/mergin/deps/pygeodiff/main.py", line 318, in make_copy_sqlite
    return self.clib.make_copy_sqlite(self.context, src, dst)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/Users/<user>/Library/Application Support/QGIS/QGIS3/profiles/keychainone/python/plugins/Mergin/mergin/deps/pygeodiff/geodifflib.py", line 476, in make_copy_sqlite
    self._parse_return_code(context, res, "make_copy_sqlite")

  File "/Users/<user>/Library/Application Support/QGIS/QGIS3/profiles/keychainone/python/plugins/Mergin/mergin/deps/pygeodiff/geodifflib.py", line 176, in _parse_return_code
    raise GeoDiffLibError(msg)

Mergin.mergin.deps.pygeodiff.geodifflib.GeoDiffLibError: Error in make_copy_sqlite:
MakeCopySqlite: backup failed: database disk image is malformed

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions