siyuan-note/siyuan · error

CardDAV: address book not found

Error message

CardDAV: address book not found

What it means

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.

Solutions

  1. List available address books and use a returned book path
  2. Refresh CardDAV state so the books map is repopulated
  3. Recreate the address book (e.g. via ImportAddressBook) if it was deleted
Defensive patterns

Strategy: try-catch

Validate before calling

if _, ok := books.Load(bookPath); !ok { return nil, handleMissingBook() }

Try / catch

if errors.Is(err, ErrorCardDavBookNotFound) {
    // refresh address book list, respond 404, offer recreation via ImportAddressBook
}

Prevention

When it happens

Trigger: GetAddressBook/DeleteAddressBook with an unknown book path; GetAddress/DeleteAddress/PutAddressObject/ListAddressObjects with an address whose parent book is absent from the map.

Common situations: Client holding a bookmark to a deleted address book; workspace switched or contact store not yet loaded; typo in the address book path segment.

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/c6392f4df98557d5. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/carddav.go:95

	defaultAddressBook = carddav.AddressBook{
		Path:                 CardDavDefaultAddressBookPath,
		Name:                 CardDavDefaultAddressBookName,
		Description:          "Default address book",
		MaxResourceSize:      addressBookMaxResourceSize,
		SupportedAddressData: addressBookSupportedAddressData,
	}
	contacts = Contacts{
		loaded:        false,
		changed:       false,
		lock:          sync.Mutex{},
		books:         sync.Map{},
		booksMetaData: []*carddav.AddressBook{},
	}

	ErrorCardDavPathInvalid = errors.New("CardDAV: path is invalid")

	ErrorCardDavBookNotFound    = errors.New("CardDAV: address book not found")
	ErrorCardDavBookPathInvalid = errors.New("CardDAV: address book path is invalid")

	ErrorCardDavAddressNotFound                 = errors.New("CardDAV: address not found")
	ErrorCardDavAddressFileExtensionNameInvalid = errors.New("CardDAV: address file extension name is invalid")
)

// ImportAddressBook imports an address book from a vCard file (*.vcf)
func ImportAddressBook(addressBookPath, cardContent string) (addresses []*AddressObject, err error) {
	// TODO: Check whether the path is valid (PathDepth: Address)
	// TODO: Check whether the address book exists
	// TODO: Decode the card content
	// TODO: Save the cards to the file system
	return
}

// ExportAddressBook exports an address book to a vCard file (*.vcf)
func ExportAddressBook(addressBookPath string) (cardContent string, err error) {
	// TODO: Check whether the path is valid (PathDepth: AddressBook)

View on GitHub (pinned to 9f775e8a12)