{"record":{"id":"3745aeede8ec6bad","repo":"siyuan-note/siyuan","slug":"carddav-path-is-invalid","errorCode":null,"errorMessage":"CardDAV: path is invalid","messagePattern":"CardDAV: path is invalid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/carddav.go","lineNumber":93,"sourceCode":"\t\t},\n\t}\n\n\tdefaultAddressBook = carddav.AddressBook{\n\t\tPath:                 CardDavDefaultAddressBookPath,\n\t\tName:                 CardDavDefaultAddressBookName,\n\t\tDescription:          \"Default address book\",\n\t\tMaxResourceSize:      addressBookMaxResourceSize,\n\t\tSupportedAddressData: addressBookSupportedAddressData,\n\t}\n\tcontacts = Contacts{\n\t\tloaded:        false,\n\t\tchanged:       false,\n\t\tlock:          sync.Mutex{},\n\t\tbooks:         sync.Map{},\n\t\tbooksMetaData: []*carddav.AddressBook{},\n\t}\n\n\tErrorCardDavPathInvalid = errors.New(\"CardDAV: path is invalid\")\n\n\tErrorCardDavBookNotFound    = errors.New(\"CardDAV: address book not found\")\n\tErrorCardDavBookPathInvalid = errors.New(\"CardDAV: address book path is invalid\")\n\n\tErrorCardDavAddressNotFound                 = errors.New(\"CardDAV: address not found\")\n\tErrorCardDavAddressFileExtensionNameInvalid = errors.New(\"CardDAV: address file extension name is invalid\")\n)\n\n// ImportAddressBook imports an address book from a vCard file (*.vcf)\nfunc ImportAddressBook(addressBookPath, cardContent string) (addresses []*AddressObject, err error) {\n\t// TODO: Check whether the path is valid (PathDepth: Address)\n\t// TODO: Check whether the address book exists\n\t// TODO: Decode the card content\n\t// TODO: Save the cards to the file system\n\treturn\n}\n\n// ExportAddressBook exports an address book to a vCard file (*.vcf)","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/carddav.go#L75-L111","documentation":"ErrorCardDavPathInvalid is the generic path-shape error of the CardDAV layer, returned by QueryAddressObjects when the request path matches none of the recognized CardDAV path shapes (the default branch of the depth/shape switch). It indicates a URL that is neither the root, an address book, nor an address object path.","triggerScenarios":"QueryAddressObjects invoked with a path whose structure hits the switch's default case, i.e. an unrecognized depth or segment arrangement.","commonSituations":"CalDAV/CardDAV clients probing unknown collections; hand-built URLs with wrong segment counts; clients configured with a wrong principal/collection base path.","solutions":["Use a path returned by the CardDAV discovery/listing endpoints","Verify the configured CardDAV base URL has the expected segment layout","Check GetCardDavPathDepth of your path against the supported depths before calling"],"exampleFix":"// before\nQueryAddressObjects(\"/dav/carddav/some/deep/nested/path/\")\n// after\nQueryAddressObjects(\"/dav/carddav/addressbooks/mybook/\")","handlingStrategy":"validation","validationCode":"depth := GetCardDavPathDepth(p)\nif depth != cardDavPathDepth_Book && depth != cardDavPathDepth_Address {\n    return fmt.Errorf(\"unrecognized CardDAV path: %q\", p)\n}","typeGuard":null,"tryCatchPattern":"if errors.Is(err, ErrorCardDavPathInvalid) {\n    // re-discover the CardDAV collection layout and retry with valid hrefs\n}","preventionTips":["Use discovery/PROPFIND results as the only source of collection URLs","Do not hand-construct nested paths under the CardDAV root","Log the full offending path to catch client base-URL misconfiguration"],"tags":["carddav","url","validation"],"backgroundTag":"invalid-url-format","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"}