home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.18k stars 30.2k forks source link

Caldav not working anymore with 2023.12.2 #105738

Open derjoerg opened 9 months ago

derjoerg commented 9 months ago

The problem

Starting with 2023.12.0 caldav isn't working for me anymore. First I thought it is related to issue #90300 as I got the "maximum recursion deepth" error message. Now I've updated to 2023.12.2 and tried a complete new caldav setup with a brand new baikal-server in the local network. I now receive an "500 Internal Server Error" in the home-assistant.logs (see below). I tried a simple python-script with caldav and everything is working as expected. Also with my android and thunderbird on windows I'm able to connect to the calendar without a problem

What version of Home Assistant Core has the issue?

core-2023.12.2

What was the last working version of Home Assistant Core?

core-2023.11

What type of installation are you running?

Home Assistant OS

Integration causing the issue

caldav

Link to integration documentation on our website

https://www.home-assistant.io/integrations/caldav/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.caldav.coordinator
Source: helpers/update_coordinator.py:300
Integration: CalDAV (documentation, issues)
First occurred: 12:06:27 (21 occurrences)
Last logged: 16:16:51

Unexpected error fetching CalDAV Common Calendar data: ReportError at '500 Internal Server Error b'<?xml version="1.0" encoding="utf-8"?>\n<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">\n <s:sabredav-version>4.3.1</s:sabredav-version>\n <s:exception>Sabre\\VObject\\ParseException</s:exception>\n <s:message>This parser only supports VCARD and VCALENDAR files</s:message>\n</d:error>\n'', reason no reason
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/caldav/coordinator.py", line 81, in _async_update_data
    results = await self.hass.async_add_executor_job(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/caldav/objects.py", line 1079, in search
    (response, objects) = self._request_report_build_resultlist(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/caldav/objects.py", line 958, in _request_report_build_resultlist
    response = self._query(xml, 1, "report")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/caldav/objects.py", line 216, in _query
    raise error.exception_by_method[query_method](errmsg(ret))
caldav.lib.error.ReportError: ReportError at '500 Internal Server Error

b'<?xml version="1.0" encoding="utf-8"?>\n<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">\n  <s:sabredav-version>4.3.1</s:sabredav-version>\n  <s:exception>Sabre\\VObject\\ParseException</s:exception>\n  <s:message>This parser only supports VCARD and VCALENDAR files</s:message>\n</d:error>\n'', reason no reason

Additional information

No response

home-assistant[bot] commented 9 months ago

caldav documentation caldav source

gpala7077 commented 9 months ago

I am having the same problem.

purche42 commented 9 months ago

Same problem here. Not sure if Baikal works at all with that integration.

derjoerg commented 9 months ago

@purche42 Regarding the official documentation https://www.home-assistant.io/integrations/caldav/ the integration was tested against Baikal.

t0mcat1337 commented 8 months ago

No idea if this could have a similar root cause, but for me caldav in combination with a Kopano Server is broken, too (see https://github.com/home-assistant/core/issues/105680)

In my last post (https://github.com/home-assistant/core/issues/105680#issuecomment-1893778476) I was able to determine different request beahviours between the different HA versions...

derjoerg commented 8 months ago

So with a current baikal server I get the errors mentioned in this issue. I also tried it now with an up-to-date Kopano server and just nothing happens (no errors in the log, but also no calendar is created).

So for me the complete caldav-integration in HA is broken :(

christianlilja commented 8 months ago

Got the same issue with latest updates.

t0mcat1337 commented 8 months ago

@derjoerg I have the same issue with a Kopano Server as u described and so a while ago I opened this issue here (https://github.com/home-assistant/core/issues/105680).

In my last comment there I was able to identify the root cause concerning Kopano, just take a look: https://github.com/home-assistant/core/issues/105680#issuecomment-1893930324

tobixen commented 7 months ago

Perhaps it's related to https://github.com/python-caldav/caldav/issues/384

If someone can create a test-account for me on their baikal or kopano server, I can try to run the python-caldav functional test suite and see if anything breaks.

rarroyo6 commented 6 months ago

Still happening with HA 2024.3.2. Setup works fine with Thunderbird.

QazCetelic commented 4 months ago

Still a problem with 2024.5.2

phyk commented 4 months ago

Is this related to #111421?

QazCetelic commented 4 months ago

I'm using Nextcloud, not Baikal. It seems to be a more generic issue.

phyk commented 3 months ago

I'm using Nextcloud, not Baikal. It seems to be a more generic issue.

As I am using Baikal, the fix suggested there works for me. It might be the problem here is related/similar, but I don't know.

tobixen commented 3 months ago

I'm using Nextcloud, not Baikal. It seems to be a more generic issue.

In general, if the traceback says "500 internal server error", then the problem can be anything. The problem is most likely on the server side, and it may include things like full disk on the server side. I don't think it's a "generic issue". That said, if all users of some specific verson set of HomeAssistant experiences 500 Internal Server Error with their Baikal servers, while other software works towards Baikal, then there is something in HomeAssistant or in ("my") CalDAV client python library that triggers the bug.

The next version of "my" caldav library will have debugging hooks in place for dumping the caldav communication to disk. This will help a lot for pinpointing what triggers errors like this one.

cbram commented 2 months ago

I am running into the same issue with a Baikal based on ckulka/baikal:nginx Docker image. The server works nicely for Apples calendar app, so no generic issue from server side. I am running HA 2024.7.2