siyuan-note/siyuan · error
invalid imported notebook identity [%s]: %w
Error message
invalid imported notebook identity [%s]: %w
What it means
Thrown by validateImportedNotebookIdentities when the encryption backup file (notebookCryptoBackupFilename under .siyuan/) exists but readBoxEncryptionFile fails to read or parse it. This backup file stores the notebook's encryption identity (salt, verifier, wrapped DEK) as a fallback when conf.json's BoxCrypt is missing or invalid. The error wraps the underlying read/parse error.
Source
Thrown at kernel/model/import.go:1065
backupPath := filepath.Join(boxDir, ".siyuan", notebookCryptoBackupFilename)
var boxConf *conf.BoxConf
if filelock.IsExist(confPath) {
data, readErr := filelock.ReadFile(confPath)
if readErr != nil {
return nil, fmt.Errorf("read imported notebook conf [%s] failed: %w", boxID, readErr)
}
boxConf = conf.NewBoxConf()
if unmarshalErr := gulu.JSON.UnmarshalJSON(data, boxConf); unmarshalErr != nil {
return nil, fmt.Errorf("parse imported notebook conf [%s] failed: %w", boxID, unmarshalErr)
}
}
var backup *conf.BoxEncryption
if filelock.IsExist(backupPath) {
backup, err = readBoxEncryptionFile(backupPath)
if err != nil {
return nil, fmt.Errorf("invalid imported notebook identity [%s]: %w", boxID, err)
}
}
var boxCrypt *conf.BoxEncryption
if boxConf != nil && boxConf.Encrypted {
if boxConf.BoxCrypt != nil && validateBoxEncryption(boxConf.BoxCrypt) == nil {
boxCrypt = boxConf.BoxCrypt
} else {
boxCrypt = backup
}
if boxCrypt == nil {
return nil, fmt.Errorf("encrypted notebook [%s] has no valid identity", boxID)
}
} else if boxConf != nil && backup != nil {
return nil, fmt.Errorf("notebook [%s] has conflicting normal and encrypted identities", boxID)
} else if backup != nil {
boxCrypt = backup
}View on GitHub (pinned to 251596fc0d)
Solutions
- Re-export the Data.zip from the source SiYuan instance to get a clean backup file.
- Check if the source and target SiYuan versions are compatible (encryption format may have changed between versions).
- Inspect the wrapped error for the specific parse/read failure.
- If the notebook is not meant to be encrypted, remove the backup file from the Data.zip before importing.
Defensive patterns
Strategy: try-catch
Try / catch
encryptedBoxIDs, err := validateImportedNotebookIdentities(tmpDataPath)
if err != nil {
if strings.Contains(err.Error(), "invalid imported notebook identity") &&
!strings.Contains(err.Error(), "validateBoxEncryption") {
// Backup encryption file is corrupt
logging.LogErrorf("encryption backup file is corrupt: %s", err)
// Suggest re-export or removing the backup file if notebook is not encrypted
}
} Prevention
- Re-export Data.zip to get a clean encryption backup file.
- Ensure SiYuan versions are compatible (encryption format may differ).
- Do not manually modify or delete encryption backup files.
- If encryption is not needed, remove the .siyuan/ backup file before importing.
When it happens
Trigger: Calling validateImportedNotebookIdentities where a notebook directory contains .siyuan/<backup-filename> that exists (filelock.IsExist returns true) but readBoxEncryptionFile returns an error at import.go:1062-1066.
Common situations: Corrupted or truncated encryption backup file from an incomplete export. Backup file from an incompatible SiYuan version with a different encryption format. Manual tampering with the backup file. Filesystem read error on the temp volume.
Related errors
- encrypted notebook [%s] has no valid identity
- notebook [%s] has conflicting normal and encrypted identitie
- Cannot import a key backup while encrypted notebooks are ena
- Decryption failed: incorrect key or corrupted data
- read imported notebook conf [%s] failed: %w
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/5b3283a0db0145ad.
Report an issue: GitHub.