siyuan-note/siyuan · error

CalDAV: calendar object not found

Error message

CalDAV: calendar object not found

What it means

ErrorCalDavCalendarObjectNotFound is the sentinel returned when a requested calendar object (an iCalendar resource) is absent from the calendarObjects sync.Map. GetObject and DeleteObject return it when the object lookup misses even though the parent calendar exists.

Solutions

  1. Re-list the calendar's objects (ListCalendarObjects) and use a currently existing object path
  2. Verify the object filename including the .ics extension matches exactly
  3. Recreate the object via PutCalendarObject if it was removed
Defensive patterns

Strategy: try-catch

Validate before calling

if _, ok := calendarObjects.Load(objectPath); !ok { return nil, handleMissingObject() }

Try / catch

if errors.Is(err, ErrorCalDavCalendarObjectNotFound) {
    // re-list objects, drop local stale entries, respond 404
}

Prevention

When it happens

Trigger: GetObject or DeleteObject with an object path whose entry is missing from the internal map, e.g. after the object was deleted or never created.

Common situations: CalDAV client retrying with an etag/URL of an already-deleted event; stale sync tokens referencing removed objects; typo in the .ics object filename.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/4c2187a43d11f399. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/caldav.go:86

	defaultCalendar = caldav.Calendar{
		Path:                  CalDavDefaultCalendarPath,
		Name:                  CalDavDefaultCalendarName,
		Description:           "Default calendar",
		MaxResourceSize:       calendarMaxResourceSize,
		SupportedComponentSet: calendarSupportedComponentSet,
	}
	calendars = Calendars{
		loaded:            false,
		changed:           false,
		lock:              sync.Mutex{},
		calendars:         sync.Map{},
		calendarsMetaData: []*caldav.Calendar{},
	}

	ErrorCalDavCalendarNotFound    = errors.New("CalDAV: calendar not found")
	ErrorCalDavCalendarPathInvalid = errors.New("CalDAV: calendar path is invalid")

	ErrorCalDavCalendarObjectNotFound    = errors.New("CalDAV: calendar object not found")
	ErrorCalDavCalendarObjectPathInvalid = errors.New("CalDAV: calendar object path is invalid")
)

// CalendarsMetaDataFilePath returns the absolute path of the calendars' meta data file
func CalendarsMetaDataFilePath() string {
	return DavPath2DirectoryPath(CalDavCalendarsMetaDataFilePath)
}

func GetCalDavPathDepth(urlPath string) CalDavPathDepth {
	urlPath = PathCleanWithSlash(urlPath)
	return CalDavPathDepth(len(strings.Split(urlPath, "/")) - 1)
}

// GetCardDavPathDepth parses
func ParseCalendarObjectPath(objectPath string) (calendarPath string, objectID string, err error) {
	calendarPath, objectFileName := path.Split(objectPath)
	calendarPath = PathCleanWithSlash(calendarPath)
	objectID = path.Base(objectFileName)

View on GitHub (pinned to 9f775e8a12)