{"record":{"id":"c6392f4df98557d5","repo":"siyuan-note/siyuan","slug":"carddav-address-book-not-found","errorCode":null,"errorMessage":"CardDAV: address book not found","messagePattern":"CardDAV: address book not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/carddav.go","lineNumber":95,"sourceCode":"\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)\nfunc ExportAddressBook(addressBookPath string) (cardContent string, err error) {\n\t// TODO: Check whether the path is valid (PathDepth: AddressBook)","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/carddav.go#L77-L113","documentation":"ErrorCardDavBookNotFound is the sentinel returned when the requested address book does not exist in the internal books sync.Map. GetAddress, DeleteAddress, GetAddressBook, DeleteAddressBook, ListAddressObjects and PutAddressObject all return it when the parent address book lookup misses.","triggerScenarios":"GetAddressBook/DeleteAddressBook with an unknown book path; GetAddress/DeleteAddress/PutAddressObject/ListAddressObjects with an address whose parent book is absent from the map.","commonSituations":"Client holding a bookmark to a deleted address book; workspace switched or contact store not yet loaded; typo in the address book path segment.","solutions":["List available address books and use a returned book path","Refresh CardDAV state so the books map is repopulated","Recreate the address book (e.g. via ImportAddressBook) if it was deleted"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if _, ok := books.Load(bookPath); !ok { return nil, handleMissingBook() }","typeGuard":null,"tryCatchPattern":"if errors.Is(err, ErrorCardDavBookNotFound) {\n    // refresh address book list, respond 404, offer recreation via ImportAddressBook\n}","preventionTips":["Derive address book paths from listing responses only","Drop client-side bookmarks when an address book is deleted","Ensure CardDAV state is loaded before issuing object-level operations"],"tags":["carddav","not-found","address-book"],"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"}