{"record":{"id":"5b3283a0db0145ad","repo":"siyuan-note/siyuan","slug":"invalid-imported-notebook-identity-s-w","errorCode":null,"errorMessage":"invalid imported notebook identity [%s]: %w","messagePattern":"invalid imported notebook identity \\[(.+?)\\]: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/import.go","lineNumber":1065,"sourceCode":"\t\tbackupPath := filepath.Join(boxDir, \".siyuan\", notebookCryptoBackupFilename)\n\n\t\tvar boxConf *conf.BoxConf\n\t\tif filelock.IsExist(confPath) {\n\t\t\tdata, readErr := filelock.ReadFile(confPath)\n\t\t\tif readErr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"read imported notebook conf [%s] failed: %w\", boxID, readErr)\n\t\t\t}\n\t\t\tboxConf = conf.NewBoxConf()\n\t\t\tif unmarshalErr := gulu.JSON.UnmarshalJSON(data, boxConf); unmarshalErr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parse imported notebook conf [%s] failed: %w\", boxID, unmarshalErr)\n\t\t\t}\n\t\t}\n\n\t\tvar backup *conf.BoxEncryption\n\t\tif filelock.IsExist(backupPath) {\n\t\t\tbackup, err = readBoxEncryptionFile(backupPath)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid imported notebook identity [%s]: %w\", boxID, err)\n\t\t\t}\n\t\t}\n\n\t\tvar boxCrypt *conf.BoxEncryption\n\t\tif boxConf != nil && boxConf.Encrypted {\n\t\t\tif boxConf.BoxCrypt != nil && validateBoxEncryption(boxConf.BoxCrypt) == nil {\n\t\t\t\tboxCrypt = boxConf.BoxCrypt\n\t\t\t} else {\n\t\t\t\tboxCrypt = backup\n\t\t\t}\n\t\t\tif boxCrypt == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"encrypted notebook [%s] has no valid identity\", boxID)\n\t\t\t}\n\t\t} else if boxConf != nil && backup != nil {\n\t\t\treturn nil, fmt.Errorf(\"notebook [%s] has conflicting normal and encrypted identities\", boxID)\n\t\t} else if backup != nil {\n\t\t\tboxCrypt = backup\n\t\t}","sourceCodeStart":1047,"sourceCodeEnd":1083,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/import.go#L1047-L1083","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"encryptedBoxIDs, err := validateImportedNotebookIdentities(tmpDataPath)\nif err != nil {\n    if strings.Contains(err.Error(), \"invalid imported notebook identity\") &&\n       !strings.Contains(err.Error(), \"validateBoxEncryption\") {\n        // Backup encryption file is corrupt\n        logging.LogErrorf(\"encryption backup file is corrupt: %s\", err)\n        // Suggest re-export or removing the backup file if notebook is not encrypted\n    }\n}","preventionTips":["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."],"tags":["encryption","import","data-zip","identity","backup"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}