Error when syncing project.

Open
#960 2 comments 0 reactions 1 assignee View on GitHub

@harminius is already working on this.

Since Nov 11, 2026.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
54/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
backend

Research direction

The traceback points to mergin/merginproject.py in inspect_files() and mergin/utils.py in generate_checksum(). Start by tracing how a mistakenly opened TIFF is included in the files inspected during sync, then reproduce the error and identify which file read fails. Done means syncing recovers without requiring the local project to be deleted and downloaded again.

Written by the indexing model from the issue text.

Description

If I accidentally open a tiff file from a Mergin project (in the sidebar) instead of the project file and then I try to open the project file and try to do a sync, I get the following error and the project cannot be synced anymore, I have to delete the local project and redownload it.


OSError: [Errno 22] Invalid argument 
Traceback (most recent call last):
  File "C:\Users/adrianearaujo/AppData/Roaming/QGIS/QGIS3\profiles\adriane/python/plugins\Mergin\plugin.py", line 484, in current_project_sync
    self.manager.project_status(self.mergin_proj_dir)
  File "C:\Users/adrianearaujo/AppData/Roaming/QGIS/QGIS3\profiles\adriane/python/plugins\Mergin\projects_manager.py", line 256, in project_status
    pull_changes, push_changes, push_changes_summary = self.mc.project_status(project_dir)
                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users/adrianearaujo/AppData/Roaming/QGIS/QGIS3\profiles\adriane/python/plugins\Mergin\mergin\client.py", line 1162, in project_status
    push_changes = mp.get_push_changes()
                   ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users/adrianearaujo/AppData/Roaming/QGIS/QGIS3\profiles\adriane/python/plugins\Mergin\mergin\merginproject.py", line 658, in get_push_changes
    changes = self.compare_file_sets(self.files(), self.inspect_files())
                                                   ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users/adrianearaujo/AppData/Roaming/QGIS/QGIS3\profiles\adriane/python/plugins\Mergin\mergin\merginproject.py", line 324, in inspect_files
    "checksum": generate_checksum(abs_path),
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users/adrianearaujo/AppData/Roaming/QGIS/QGIS3\profiles\adriane/python/plugins\Mergin\mergin\utils.py", line 26, in generate_checksum
    chunk = f.read(chunk_size)
            ^^^^^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument


Versão do Python: 3.12.14 (main, Aug 19 2026, 09:39:31) [MSC v.1944 64 bit (AMD64)] 
Versão do QGIS: 3.44.13-Solothurn Solothurn, 2c8a7782a96 

Caminho do Python:
C:/OSGeo4W/apps/qgis-ltr/./python
C:/Users/adrianearaujo/AppData/Roaming/QGIS/QGIS3\profiles\adriane/python
C:/Users/adrianearaujo/AppData/Roaming/QGIS/QGIS3\profiles\adriane/python/plugins
C:/OSGeo4W/apps/qgis-ltr/./python/plugins
C:\OSGeo4W\bin\python312.zip
C:\OSGeo4W\apps\Python312\DLLs
C:\OSGeo4W\apps\Python312\Lib
C:\OSGeo4W\bin
C:\OSGeo4W\apps\Python312
C:\OSGeo4W\apps\Python312\Lib\site-packages
C:\OSGeo4W\apps\Python312\Lib\site-packages\win32
C:\OSGeo4W\apps\Python312\Lib\site-packages\win32\lib
C:\OSGeo4W\apps\Python312\Lib\site-packages\Pythonwin
C:/Users/adrianearaujo/AppData/Roaming/QGIS/QGIS3\profiles\adriane/python
C:\Users\adrianearaujo\AppData\Roaming\QGIS\QGIS3\profiles\adriane\python\plugins\Mergin\mergin\deps\click-8.1.3-py3-none-any.whl
C:\Users\adrianearaujo\AppData\Roaming\QGIS\QGIS3\profiles\adriane\python\plugins\Mergin\mergin\deps\pygeodiff
C:\Users\adrianearaujo\AppData\Roaming\QGIS\QGIS3\profiles\adriane\python\plugins\Mergin\mergin\deps\python_dateutil-2.8.2-py2.py3-none-any.whl
C:\Users\adrianearaujo\AppData\Roaming\QGIS\QGIS3\profiles\adriane\python\plugins\Mergin\mergin\deps\pytz-2022.1-py2.py3-none-any.whl
C:\Users\adrianearaujo\AppData\Roaming\QGIS\QGIS3\profiles\adriane\python\plugins\Mergin\mergin\deps\six-1.17.0-py2.py3-none-any.whl
C:\Users\adrianearaujo\AppData\Roaming\QGIS\QGIS3\profiles\adriane\python\plugins\Mergin\mergin\deps\truststore-0.10.4-py3-none-any.whl
C:\Users\adrianearaujo\AppData\Roaming\QGIS\QGIS3\profiles\adriane\python\plugins\Mergin\mergin\deps\__init__.py
C:\Users\adrianearaujo\AppData\Roaming\QGIS\QGIS3\profiles\adriane\python\plugins\Mergin\mergin\deps\__pycache__
E:/MerginMaps/Macae_Malvinas_010/macae_os2624010_fisico_tab10```
Dominant language
Python
Stars
45
Forks
21
Avg merge
3d 13h
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MerginMaps/qgis-plugin

All issues in MerginMaps/qgis-plugin

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.