{"record":{"id":"fd2d7059419568b6","repo":"siyuan-note/siyuan","slug":"encrypted-notebooks-do-not-support-this-operation-fd2d70","errorCode":null,"errorMessage":"Encrypted notebooks do not support this operation","messagePattern":"Encrypted notebooks do not support this operation","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/import.go","lineNumber":329,"sourceCode":"\t\t\tboxConf := box.GetConf()\n\t\t\tboxConf.Icon = filterBoxIcon(importedBoxConf.Icon)\n\t\t\tboxConf.RefCreateSavePath = importedBoxConf.RefCreateSavePath\n\t\t\tboxConf.DocCreateSavePath = importedBoxConf.DocCreateSavePath\n\t\t\tboxConf.DocCreateTemplatePath = importedBoxConf.DocCreateTemplatePath\n\t\t\tboxConf.DailyNoteSavePath = importedBoxConf.DailyNoteSavePath\n\t\t\tboxConf.DailyNoteTemplatePath = importedBoxConf.DailyNoteTemplatePath\n\t\t\tboxConf.SortMode = importedBoxConf.SortMode\n\t\t\tif err = box.SaveConf(boxConf); err != nil {\n\t\t\t\treturn createdBoxID, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\tcreatedBoxID = boxID\n\t}\n\tencryptedTarget := IsEncryptedBox(boxID)\n\tstorageRiffDir := filepath.Join(unzipRootPath, \"storage\", \"riff\")\n\tif encryptedTarget && gulu.File.IsExist(storageRiffDir) {\n\t\treturn createdBoxID, errors.New(Conf.Language(313))\n\t}\n\ttoPath = normalizeBoxDocTarget(boxID, toPath)\n\n\tluteEngine := util.NewLute()\n\tblockIDs := sharedBlockIDs\n\tif nil == blockIDs {\n\t\tblockIDs = map[string]string{}\n\t}\n\ttrees := map[string]*parse.Tree{}\n\timportedBoxDoc := false\n\tcontainsFlashcardAttrs := false\n\n\t// 重新生成块 ID\n\tfor i, syPath := range syPaths {\n\t\tdata, readErr := os.ReadFile(syPath)\n\t\tif nil != readErr {\n\t\t\tlogging.LogErrorf(\"read .sy [%s] failed: %s\", syPath, readErr)\n\t\t\terr = readErr","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/afa823b6b4e4f183511e0bc0a3be93caa94c7c97/kernel/model/import.go#L311-L347","documentation":"The import target is an encrypted notebook (IsEncryptedBox) and the archive contains a storage/riff directory, i.e. flashcard deck data. Flashcard decks are stored in the global plaintext directory data/storage/riff and merged into the built-in deck, which encrypted notebooks cannot participate in, so importSY0 aborts early with Language(313) 'Encrypted notebooks do not support this operation'. If a notebook was being created for the import, the deferred rollback removes it.","triggerScenarios":"Any importSY-family call into an encrypted box with an archive exported from a notebook whose documents carry flashcards - the export includes storage/riff/<deck> files. Detected right after target resolution, before trees are parsed.","commonSituations":"Migrating spaced-repetition material into an encrypted notebook. Users enabling notebook encryption and then trying to restore old flashcard-bearing exports.","solutions":["Import into a non-encrypted notebook instead","Or strip flashcard data from the archive (remove storage/riff and riff-decks attributes) before importing - the cards will be lost","Keep the notebook unencrypted if preserving flashcards matters more than encryption"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func archiveHasRiffStorage(zipPath string) bool {\n    r, err := zip.OpenReader(zipPath)\n    if err != nil {\n        return false\n    }\n    defer r.Close()\n    for _, f := range r.File {\n        if strings.Contains(f.Name, \"storage/riff/\") {\n            return true\n        }\n    }\n    return false\n}\n\nif model.IsEncryptedBox(boxID) && archiveHasRiffStorage(zipPath) {\n    // refuse early: encrypted targets cannot take flashcard data\n}","typeGuard":"func isEncryptedUnsupported(err error) bool {\n    return err != nil && err.Error() == model.Conf.Language(313)\n}","tryCatchPattern":"if err := model.ImportSY(zipPath, boxID, toPath); err != nil {\n    if err.Error() == model.Conf.Language(313) {\n        // retry against a non-encrypted notebook, or strip flashcard data from the archive\n    }\n}","preventionTips":["Check model.IsEncryptedBox(target) before offering flashcard-bearing archives for import","Document the restriction: flashcards cannot migrate into encrypted notebooks","Clean both storage/riff and riff-decks attributes when sanitizing archives for encrypted targets"],"tags":["siyuan","import","encrypted-notebook","flashcards","validation"],"backgroundTag":"operation-unsupported-on-encrypted-store","analyzedSha":"afa823b6b4e4f183511e0bc0a3be93caa94c7c97","analyzedAt":"2026-08-18T17:04:10.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}