siyuan-note/siyuan · error

Encrypted notebooks do not support this operation

Error message

Encrypted notebooks do not support this operation

What it means

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.

Solutions

  1. Re-issue with flashcard=false (or omit the flag) for encrypted notebooks
  2. Point flashcard-filtered views only at non-encrypted notebooks
  3. Keep flashcard review flows on non-encrypted notebooks

Example fix

// before: flashcard filter on an encrypted notebook
files, totals, err := model.ListDocTree(encBoxID, "/", sort, true, false, max)

// after: skip the flashcard filter for encrypted notebooks
flashcard := !model.IsEncryptedBox(encBoxID)
files, totals, err = model.ListDocTree(encBoxID, "/", sort, flashcard, false, max)
Defensive patterns

Strategy: validation

Validate before calling

if flashcard && model.IsEncryptedBox(boxID) {
	flashcard = false // or reject with a clear message
}
files, totals, err := model.ListDocTree(boxID, p, sortMode, flashcard, showHidden, max)

Prevention

When it happens

Trigger: POST /api/filetree/listDocsByPath or /api/filetree/listDocTree with {"notebook":"<encrypted-box>","flashcard":true}.

Common situations: 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.

Related errors


AI-assisted analysis of siyuan-note/siyuan@afa823b6b4 (2026-08-18). Data as JSON: /api/errors/e3f7376eb00ed30b. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/file.go:452

	}

	sortMode = Conf.FileTree.Sort
	boxConf := box.GetConf()
	if util.SortModeFileTree != boxConf.SortMode {
		sortMode = boxConf.SortMode
	}
	return
}

func ListDocTree(boxID, listPath string, sortMode int, flashcard, showHidden bool, maxListCount int) (ret []*File, totals int, err error) {
	//os.MkdirAll("pprof", 0755)
	//cpuProfile, _ := os.Create("pprof/cpu_profile_list_doc_tree")
	//pprof.StartCPUProfile(cpuProfile)
	//defer pprof.StopCPUProfile()

	ret = []*File{}
	if flashcard && IsEncryptedBox(boxID) {
		return nil, 0, errors.New(Conf.Language(313))
	}

	var deck *riff.Deck
	var deckBlockIDs []string
	if flashcard {
		deck = Decks[builtinDeckID]
		if nil == deck {
			return
		}

		deckBlockIDs = deck.GetBlockIDs()
	}

	box := Conf.Box(boxID)
	if nil == box {
		return nil, 0, errors.New(Conf.Language(0))
	}

View on GitHub (pinned to afa823b6b4)