{"record":{"id":"d4a49597ab7981b6","repo":"siyuan-note/siyuan","slug":"imported-notebook-s-contains-encrypted-payload","errorCode":null,"errorMessage":"imported notebook [%s] contains encrypted payload without identity","messagePattern":"imported notebook \\[(.+?)\\] contains encrypted payload without identity","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/import.go","lineNumber":1090,"sourceCode":"\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}\n\n\t\tpayloadFound, payloadErr := hasEncryptedNotebookPayloadAtPath(boxDir)\n\t\tif payloadErr != nil {\n\t\t\treturn nil, fmt.Errorf(\"inspect imported notebook [%s] failed: %w\", boxID, payloadErr)\n\t\t}\n\t\tif boxCrypt == nil && payloadFound {\n\t\t\treturn nil, fmt.Errorf(\"imported notebook [%s] contains encrypted payload without identity\", boxID)\n\t\t}\n\t\tif boxCrypt == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err = validateBoxEncryption(boxCrypt); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid imported notebook identity [%s]: %w\", boxID, err)\n\t\t}\n\t\tif filelock.IsExist(filepath.Join(util.DataDir, boxID)) && IsEncryptedBox(boxID) {\n\t\t\treturn nil, fmt.Errorf(\"refuse to overwrite existing encrypted notebook [%s]\", boxID)\n\t\t}\n\t\tencryptedBoxIDs = append(encryptedBoxIDs, boxID)\n\t}\n\treturn encryptedBoxIDs, nil\n}\n\nfunc ImportData(zipPath string) (err error) {\n\tutil.PushEndlessProgress(Conf.Language(73))","sourceCodeStart":1072,"sourceCodeEnd":1108,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/import.go#L1072-L1108","documentation":"Thrown by validateImportedNotebookIdentities when no encryption identity was resolved (boxCrypt == nil after checking conf.json and backup), but the directory walk detected files with encrypted-notebook data headers. This means the notebook contains encrypted .sy files but has no credentials to decrypt them — the data would be permanently inaccessible after import. The import is refused to protect the user from importing unrecoverable data.","triggerScenarios":"Calling validateImportedNotebookIdentities where boxCrypt is nil (no encryption identity from conf.json or backup) AND hasEncryptedNotebookPayloadAtPath returns payloadFound == true. The check is at import.go:1089-1091.","commonSituations":"Exporting only the notebook data directory without the .siyuan/ identity files. Partial backup where encryption identity was stored separately and not included. Data corruption that removed identity files while leaving encrypted content. Manual extraction and re-zipping that dropped hidden directories.","solutions":["Re-export the Data.zip ensuring the complete .siyuan/ directory (including encryption identity files) is included.","If the encryption identity is permanently lost, the encrypted data cannot be recovered — obtain a fresh export from the source.","Remove the encrypted notebook directory from the Data.zip if it is not needed, then import the rest.","If you have the master password and a separate identity backup, manually restore the identity files into the .siyuan/ directory before importing."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check for orphaned encrypted payload before importing\nfunc checkOrphanedPayload(tmpDataPath, boxID string) error {\n    boxDir := filepath.Join(tmpDataPath, boxID)\n    confPath := filepath.Join(boxDir, \".siyuan\", \"conf.json\")\n    backupPath := filepath.Join(boxDir, \".siyuan\", notebookCryptoBackupFilename)\n    hasIdentity := false\n    if filelock.IsExist(confPath) {\n        data, _ := filelock.ReadFile(confPath)\n        bc := conf.NewBoxConf()\n        if gulu.JSON.UnmarshalJSON(data, bc) == nil && bc.Encrypted && bc.BoxCrypt != nil {\n            hasIdentity = true\n        }\n    }\n    if !hasIdentity && filelock.IsExist(backupPath) {\n        hasIdentity = true\n    }\n    if !hasIdentity {\n        found, _ := hasEncryptedNotebookPayloadAtPath(boxDir)\n        if found {\n            return fmt.Errorf(\"notebook %s has encrypted files but no identity\", boxID)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"encryptedBoxIDs, err := validateImportedNotebookIdentities(tmpDataPath)\nif err != nil {\n    if strings.Contains(err.Error(), \"encrypted payload without identity\") {\n        // Data is unrecoverable without identity — must re-export with identity files\n        return fmt.Errorf(\"cannot import: encrypted data has no identity — re-export with .siyuan/ directory\")\n    }\n}","preventionTips":["Always include the complete .siyuan/ directory when exporting Data.zip.","Do not selectively extract files from the Data.zip — use the complete archive.","If the identity is permanently lost, the encrypted data cannot be imported.","Verify the archive includes identity files for any encrypted notebooks before importing."],"tags":["encryption","import","data-zip","orphaned-data","unrecoverable"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}