pimutils / pimutils/vdirsyncer

Sync aborted after a single error

Open
#1,101 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
Python
Stars
1.9k
Forks
185
Avg merge
11h 49m
Merged PRs (30d)
1

Description

When running a sync, vdirsyncer migrates a contact with two FN properties, which actually is not supported in sabre older versions. The attempt fails, which is fine to me (after all that's a sabre issue).

Here is the original error:

error: Unknown error occurred for bob_contacts/contacts: 415, message='Unsupported Media Type', url=URL('https://dav.poc-mail-avocat.fr/addressbooks/6528c0dbbc1b180078e2aec4/contacts/sabre-vobject-8c1de447-93f7-457b-a37f-e5c237a11914.vcf')
error: Use `-vdebug` to see the full traceback.
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/cli/utils.py", line 70, in handle_cli_error
debug:     raise e
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/sync/__init__.py", line 160, in sync
debug:     await action.run(a_info, b_info, conflict_resolution, partial_sync)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/sync/__init__.py", line 183, in run
debug:     await self._run_impl(a, b)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/sync/__init__.py", line 212, in _run_impl
debug:     href, etag = await self.dest.storage.upload(self.item)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/base.py", line 22, in inner
debug:     return await f(self, *args, **kwargs)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/base.py", line 22, in inner
debug:     return await f(self, *args, **kwargs)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 601, in upload
debug:     rv = await self._put(href, item, None)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 569, in _put
debug:     response = await self.session.request(
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 416, in request
debug:     return await http.request(method, url, session=session, **more)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/http.py", line 157, in request
debug:     response.raise_for_status()
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1011, in raise_for_status
debug:     raise ClientResponseError(

However the follow up operation fails, the next one with:

error: Unknown error occurred for bob_contacts/contacts: 415, message='Unsupported Media Type', url=URL('https://dav.poc-mail-avocat.fr/addressbooks/6528c0dbbc1b180078e2aec4/contacts/sabre-vobject-8c1de447-93f7-457b-a37f-e5c237a11914.vcf')
error: Use `-vdebug` to see the full traceback.
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/cli/utils.py", line 70, in handle_cli_error
debug:     raise e
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/sync/__init__.py", line 160, in sync
debug:     await action.run(a_info, b_info, conflict_resolution, partial_sync)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/sync/__init__.py", line 183, in run
debug:     await self._run_impl(a, b)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/sync/__init__.py", line 212, in _run_impl
debug:     href, etag = await self.dest.storage.upload(self.item)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/base.py", line 22, in inner
debug:     return await f(self, *args, **kwargs)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/base.py", line 22, in inner
debug:     return await f(self, *args, **kwargs)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 601, in upload
debug:     rv = await self._put(href, item, None)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 569, in _put
debug:     response = await self.session.request(
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 416, in request
debug:     return await http.request(method, url, session=session, **more)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/http.py", line 157, in request
debug:     response.raise_for_status()
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1011, in raise_for_status

And then all with:

debug: Sending request...
error: Unknown error occurred for bob_contacts/z-server-generated--system: Session is closed
error: Use `-vdebug` to see the full traceback.
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/cli/utils.py", line 70, in handle_cli_error
debug:     raise e
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/sync/__init__.py", line 160, in sync
debug:     await action.run(a_info, b_info, conflict_resolution, partial_sync)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/sync/__init__.py", line 183, in run
debug:     await self._run_impl(a, b)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/sync/__init__.py", line 212, in _run_impl
debug:     href, etag = await self.dest.storage.upload(self.item)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/base.py", line 22, in inner
debug:     return await f(self, *args, **kwargs)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/base.py", line 22, in inner
debug:     return await f(self, *args, **kwargs)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 601, in upload
debug:     rv = await self._put(href, item, None)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 569, in _put
debug:     response = await self.session.request(
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 416, in request
debug:     return await http.request(method, url, session=session, **more)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/vdirsyncer/http.py", line 136, in request
debug:     response = await session.request(method, url, **kwargs)
debug:   File "/home/hp/.local/pipx/venvs/vdirsyncer/lib/python3.10/site-packages/aiohttp/client.py", line 426, in _request
debug:     raise RuntimeError("Session is closed")
Copying (uploading) item poc-audriga to my_destination/z-server-generated--system

My expectation would be that vdirsyncer continue to migrate and sync vcard when faced with a failure before reporting it to me (error code 1).


Things to include in your bugreport:

  • Your vdirsyncer version : vdirsyncer 0.19.2, installed using Python 3.10.12
  • If applicable, which server software (and which version) you're using
    • Origin: Sabre 4.5.2
    • Destination: Sabre 3.2.2
  • Your Python version Python 3.10.12
  • Your operating system 22.04.1-Ubuntu
  • Your config file
$ cat config.example 
[general]
# A folder where vdirsyncer can store some metadata about each pair.
status_path = "~/.vdirsyncer/status/999012/carddav"

# CARDDAV
[pair bob_contacts]
a = "my_source"
b = "my_destination"
collections = ["from a"]

# Calendars also have a color property
metadata = ["displayname", "color"]

[storage my_source]
type = "carddav"
url = "https://xxxxx/remote.php/dav/addressbooks/users/yyy"
username = "yyy"
password = "abc"

[storage my_destination]
type = "carddav"
url = "https://fgnetmetym/addressbooks/6528c0dbbc1b180078e2aec4"
username = "zzzz"
password = "def"
  • Use vdirsyncer -vdebug for debug output. The output is sensitive, but
    please attach at least the last few lines before the error (if applicable),
    censored as necessary. This is almost always the most useful information.

vdirsync.log.txt

Contributor guide

Open the contributing guide

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.

Research direction

Start in vdirsyncer/sync/init.py at the action run flow, then inspect storage/dav.py and http.py where the upload and closed-session errors occur. Reproduce the CardDAV sync failure described in the report; done means one failed item is reported while subsequent items continue syncing and the command still exits with error code 1.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.