{"record":{"id":"e3f7376eb00ed30b","repo":"siyuan-note/siyuan","slug":"encrypted-notebooks-do-not-support-this-operation-e3f737","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/file.go","lineNumber":452,"sourceCode":"\t}\n\n\tsortMode = Conf.FileTree.Sort\n\tboxConf := box.GetConf()\n\tif util.SortModeFileTree != boxConf.SortMode {\n\t\tsortMode = boxConf.SortMode\n\t}\n\treturn\n}\n\nfunc ListDocTree(boxID, listPath string, sortMode int, flashcard, showHidden bool, maxListCount int) (ret []*File, totals int, err error) {\n\t//os.MkdirAll(\"pprof\", 0755)\n\t//cpuProfile, _ := os.Create(\"pprof/cpu_profile_list_doc_tree\")\n\t//pprof.StartCPUProfile(cpuProfile)\n\t//defer pprof.StopCPUProfile()\n\n\tret = []*File{}\n\tif flashcard && IsEncryptedBox(boxID) {\n\t\treturn nil, 0, errors.New(Conf.Language(313))\n\t}\n\n\tvar deck *riff.Deck\n\tvar deckBlockIDs []string\n\tif flashcard {\n\t\tdeck = Decks[builtinDeckID]\n\t\tif nil == deck {\n\t\t\treturn\n\t\t}\n\n\t\tdeckBlockIDs = deck.GetBlockIDs()\n\t}\n\n\tbox := Conf.Box(boxID)\n\tif nil == box {\n\t\treturn nil, 0, errors.New(Conf.Language(0))\n\t}\n","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/afa823b6b4e4f183511e0bc0a3be93caa94c7c97/kernel/model/file.go#L434-L470","documentation":"ListDocTree refuses flashcard-filtered listing for encrypted notebooks: with flashcard=true and IsEncryptedBox(boxID) it returns the localized \"Encrypted notebooks do not support this operation\" (Conf.Language(313)) before reading any card data. Building the flashcard view requires scanning block/deck state across the box, which is not available while content is encrypted.","triggerScenarios":"POST /api/filetree/listDocsByPath or /api/filetree/listDocTree with {\"notebook\":\"<encrypted-box>\",\"flashcard\":true}.","commonSituations":"A plugin or view that always requests flashcard=true regardless of notebook type; switching a notebook to encrypted while a flashcard-filtered doc tree was open.","solutions":["Re-issue with flashcard=false (or omit the flag) for encrypted notebooks","Point flashcard-filtered views only at non-encrypted notebooks","Keep flashcard review flows on non-encrypted notebooks"],"exampleFix":"// before: flashcard filter on an encrypted notebook\nfiles, totals, err := model.ListDocTree(encBoxID, \"/\", sort, true, false, max)\n\n// after: skip the flashcard filter for encrypted notebooks\nflashcard := !model.IsEncryptedBox(encBoxID)\nfiles, totals, err = model.ListDocTree(encBoxID, \"/\", sort, flashcard, false, max)","handlingStrategy":"validation","validationCode":"if flashcard && model.IsEncryptedBox(boxID) {\n\tflashcard = false // or reject with a clear message\n}\nfiles, totals, err := model.ListDocTree(boxID, p, sortMode, flashcard, showHidden, max)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate flashcard features on !IsEncryptedBox(boxID)","Test listing code against encrypted notebooks"],"tags":["encryption","flashcard","filetree","notebook","policy"],"backgroundTag":"encrypted-notebook-restriction","analyzedSha":"afa823b6b4e4f183511e0bc0a3be93caa94c7c97","analyzedAt":"2026-08-18T17:04:10.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}