{"record":{"id":"e1bf4daf7caffa21","repo":"siyuan-note/siyuan","slug":"caldav-calendar-not-found","errorCode":null,"errorMessage":"CalDAV: calendar not found","messagePattern":"CalDAV: calendar not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/caldav.go","lineNumber":83,"sourceCode":"\tcalendarMaxResourceSize       int64 = 0\n\tcalendarSupportedComponentSet       = []string{\"VEVENT\", \"VTODO\"}\n\n\tdefaultCalendar = caldav.Calendar{\n\t\tPath:                  CalDavDefaultCalendarPath,\n\t\tName:                  CalDavDefaultCalendarName,\n\t\tDescription:           \"Default calendar\",\n\t\tMaxResourceSize:       calendarMaxResourceSize,\n\t\tSupportedComponentSet: calendarSupportedComponentSet,\n\t}\n\tcalendars = Calendars{\n\t\tloaded:            false,\n\t\tchanged:           false,\n\t\tlock:              sync.Mutex{},\n\t\tcalendars:         sync.Map{},\n\t\tcalendarsMetaData: []*caldav.Calendar{},\n\t}\n\n\tErrorCalDavCalendarNotFound    = errors.New(\"CalDAV: calendar not found\")\n\tErrorCalDavCalendarPathInvalid = errors.New(\"CalDAV: calendar path is invalid\")\n\n\tErrorCalDavCalendarObjectNotFound    = errors.New(\"CalDAV: calendar object not found\")\n\tErrorCalDavCalendarObjectPathInvalid = errors.New(\"CalDAV: calendar object path is invalid\")\n)\n\n// CalendarsMetaDataFilePath returns the absolute path of the calendars' meta data file\nfunc CalendarsMetaDataFilePath() string {\n\treturn DavPath2DirectoryPath(CalDavCalendarsMetaDataFilePath)\n}\n\nfunc GetCalDavPathDepth(urlPath string) CalDavPathDepth {\n\turlPath = PathCleanWithSlash(urlPath)\n\treturn CalDavPathDepth(len(strings.Split(urlPath, \"/\")) - 1)\n}\n\n// GetCardDavPathDepth parses\nfunc ParseCalendarObjectPath(objectPath string) (calendarPath string, objectID string, err error) {","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/caldav.go#L65-L101","documentation":"ErrorCalDavCalendarNotFound is the sentinel error returned by the CalDAV storage layer when the requested calendar path does not resolve to a known calendar in the in-memory calendars sync.Map. GetObject, DeleteObject, GetCalendar, DeleteCalendar, PutCalendarObject and ListCalendarObjects all return it when the calendar lookup misses.","triggerScenarios":"Calling GetCalendar/DeleteCalendar/PutCalendarObject/ListCalendarObjects with a calendar path not present in the calendars map, or GetObject/DeleteObject with an object whose parent calendar was not found.","commonSituations":"Client caching a stale calendar URL after the calendar was deleted or after workspace reload; typo in the calendar path segment; CalDAV client accessing a calendar before the server has loaded its metadata.","solutions":["List available calendars first and use a returned calendar path","Reload/refresh CalDAV state (restart or re-list) so the calendars map is populated","Recreate the calendar if it was intentionally deleted"],"exampleFix":"// before\ncal, err := GetCalendar(\"/dav/caldav/nonexistent/\")\n// after\nhomesteads, _, _ := ListCalendars()\n// pick a valid path from homesteads before calling GetCalendar","handlingStrategy":"try-catch","validationCode":"// Go: check existence first\nif _, ok := calendars.Load(calendarPath); !ok { return nil, handleMissing() }","typeGuard":null,"tryCatchPattern":"if errors.Is(err, ErrorCalDavCalendarNotFound) {\n    // refresh calendar list and retry once, else surface 404 to client\n}","preventionTips":["Always derive calendar URLs from ListCalendars responses","Invalidate client caches when calendars are deleted or renamed","Compare with errors.Is against the sentinel instead of string matching"],"tags":["caldav","not-found","calendar"],"backgroundTag":"resource-not-found","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}