{"record":{"id":"70995fbf7ee5a5e1","repo":"siyuan-note/siyuan","slug":"313","errorCode":"313","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":309,"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 := map[string]string{}\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\n\t\t\treturn\n\t\t}\n\t\ttree, _, parseErr := dataparser.ParseJSON(data, luteEngine.ParseOptions)","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/import.go#L291-L327","documentation":"Returned by importSY (import.go:309) as Conf.Language(313) = \"Encrypted notebooks do not support this operation\" when the resolved target notebook is encrypted (IsEncryptedBox(boxID)) and the archive contains a storage/riff directory (flashcard data). Flashcard import into encrypted notebooks is disabled because the riff storage layout and key handling for encrypted boxes do not support merging imported decks.","triggerScenarios":"POST /api/import/importSY (or importSYAuto resolving to an encrypted target) where the .sy.zip was exported from a notebook that had flashcards. The archive carries storage/riff, and the chosen target is an encrypted notebook.","commonSituations":"User exports a notebook with flashcards and imports it into an encrypted notebook; default notebook on the device is encrypted; policy requires encryption but the source had unencrypted flashcards.","solutions":["Import into a non-encrypted notebook, or remove the storage/riff folder from the archive before importing into an encrypted target (accepting that flashcard data will be lost).","If flashcards are required on an encrypted notebook, recreate them in the target after import via the flashcard UI.","On the client, detect an encrypted target plus a storage/riff payload and warn the user before upload."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"encryptedTarget := IsEncryptedBox(boxID)\nstorageRiffDir := filepath.Join(unzipRootPath, \"storage\", \"riff\")\nif encryptedTarget && gulu.File.IsExist(storageRiffDir) {\n    return errors.New(Conf.Language(313))\n}","typeGuard":"// importBlockedByEncryption reports whether an encrypted target cannot accept the archive's riff dir.\nfunc importBlockedByEncryption(boxID, unzipRoot string) bool {\n    return IsEncryptedBox(boxID) &&\n        gulu.File.IsExist(filepath.Join(unzipRoot, \"storage\", \"riff\"))\n}","tryCatchPattern":"err := model.ImportSY(zipPath, boxID, toPath)\nif err != nil && err.Error() == Conf.Language(313) {\n    // either pick a non-encrypted notebook, or drop storage/riff from the archive\n}","preventionTips":["Do not import flashcard-bearing archives into encrypted notebooks.","On the client, warn before upload when the target is encrypted and the source has flashcards.","If flashcards are required, recreate them in the encrypted notebook after import."],"tags":["import","encryption","flashcard","notebook","policy"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}