siyuan-note/siyuan · error

encrypted notebook metadata is missing

Error message

encrypted notebook metadata is missing

What it means

decryptBoxMetadata guard in the encrypted-notebook code: the notebook conf's BoxCrypt.Metadata ciphertext is absent or empty, so there is nothing to decrypt for the encrypted metadata (icon/sort/sortMode). Indicates a corrupted or incomplete encryption envelope on the notebook configuration.

Source

Thrown at kernel/model/box_conf_crypto.go:56

	}
	metadata := &encryptedBoxMetadata{
		Icon:     filterBoxIcon(boxConf.Icon),
		Sort:     boxConf.Sort,
		SortMode: boxConf.SortMode,
	}
	plaintext, err := gulu.JSON.MarshalJSON(metadata)
	if err != nil {
		return err
	}
	key := util.DeriveSubKey(dek, "siyuan/box-metadata")
	defer zeroAndClear(key)
	boxConf.BoxCrypt.Metadata, err = util.EncryptWithAAD(key, plaintext, boxMetadataAAD(boxID))
	return err
}

func decryptBoxMetadata(boxID string, boxConf *conf.BoxConf, dek []byte) error {
	if boxConf == nil || boxConf.BoxCrypt == nil || len(boxConf.BoxCrypt.Metadata) == 0 {
		return errors.New("encrypted notebook metadata is missing")
	}
	key := util.DeriveSubKey(dek, "siyuan/box-metadata")
	defer zeroAndClear(key)
	plaintext, err := util.DecryptWithAAD(key, boxConf.BoxCrypt.Metadata, boxMetadataAAD(boxID))
	if err != nil {
		return err
	}
	metadata := &encryptedBoxMetadata{}
	if err = gulu.JSON.UnmarshalJSON(plaintext, metadata); err != nil {
		return err
	}
	boxConf.Icon = filterBoxIcon(metadata.Icon)
	boxConf.Sort = metadata.Sort
	boxConf.SortMode = metadata.SortMode
	return nil
}

func revealBoxMetadataIfUnlocked(boxID string, boxConf *conf.BoxConf) error {

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Restore the notebook configuration from the encrypted notebook backup
  2. Verify BoxCrypt fields are intact after sync/upgrade; repair from recovery material if not
  3. Do not delete the notebook; use the documented recovery flow to preserve existing encrypted data
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at kernel/model/box_conf_crypto.go:56 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/bdf3f675330a1545. Report an issue: GitHub.