siyuan-note/siyuan · error
CalDAV: calendar object path is invalid
Error message
CalDAV: calendar object path is invalid
What it means
ErrorCalDavCalendarObjectPathInvalid is returned by ParseCalendarObjectPath when the object file extension is not the expected iCalendar extension (ICalendarFileExt, i.e. .ics). A valid calendar object path must end in an .ics file name.
Solutions
- Ensure the object path ends with a filename having the .ics extension
- Use object URLs exactly as returned by ListCalendarObjects
- Fix client URL templates that omit or alter the file extension
Example fix
// before
ParseCalendarObjectPath("/dav/caldav/calendars/mycal/event")
// after
ParseCalendarObjectPath("/dav/caldav/calendars/mycal/event.ics") Defensive patterns
Strategy: validation
Validate before calling
if filepath.Ext(objectPath) != ".ics" {
return fmt.Errorf("calendar object path must end in .ics: %q", objectPath)
} Try / catch
if errors.Is(err, ErrorCalDavCalendarObjectPathInvalid) {
// fix the URL template and return 400 to the client
} Prevention
- Always append the .ics extension when generating calendar object URLs
- Reuse object hrefs from ListCalendarObjects instead of templates
- Keep calendar and calendar-object path builders separate
When it happens
Trigger: Calling ParseCalendarObjectPath with a path whose final segment lacks the .ics extension; issuing GET/PUT/DELETE against a non-iCalendar resource inside a calendar collection.
Common situations: Clients uploading raw JSON or text files into a calendar collection; broken URL generation appending the wrong suffix; confusion between calendar and calendar-object path shapes.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- CalDAV: calendar path is invalid
- CardDAV: address book path is invalid
- CardDAV: path is invalid
- data?.msg || data?.message ||…
- invalid asset path
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/603f683f48864094.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/caldav.go:87
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)
objectFileExt := util.Ext(objectFileName)View on GitHub (pinned to 9f775e8a12)