siyuan-note/siyuan · error

target document [%s] is not in an opened and unlocked notebo

Error message

target document [%s] is not in an opened and unlocked notebook

What it means

ReorderDocs notebook guard: the target document exists, but Conf.Box(target.BoxID) returned nil — its notebook is closed, nonexistent, or currently locked (encrypted and not unlocked). Reordering requires an opened, writable notebook.

Source

Thrown at kernel/model/file.go:2668

	Notebook   string `json:"notebook,omitempty"`
	ParentPath string `json:"parentPath,omitempty"`
}

// ReorderDocs 将同级文档移动到目标文档之前或之后。
func ReorderDocs(sourceIDs []string, targetID, position string) (ret *ReorderResult, err error) {
	ret = &ReorderResult{}
	if err = validateReorderArgs(sourceIDs, targetID, position); nil != err {
		return
	}

	FlushTxQueue()
	target := treenode.GetBlockTree(targetID)
	if !isSortableDocument(target) {
		return ret, fmt.Errorf("target document [%s] not found", targetID)
	}
	box := Conf.Box(target.BoxID)
	if nil == box {
		return ret, fmt.Errorf("target document [%s] is not in an opened and unlocked notebook", targetID)
	}
	parentPath := path.Dir(target.Path)
	for _, sourceID := range sourceIDs {
		source := treenode.GetBlockTree(sourceID)
		if !isSortableDocument(source) {
			return ret, fmt.Errorf("source document [%s] not found", sourceID)
		}
		if source.BoxID != target.BoxID || path.Dir(source.Path) != parentPath {
			return ret, fmt.Errorf("source document [%s] is not a sibling of target document [%s]", sourceID, targetID)
		}
	}

	fileTreeSortLock.Lock()
	confPath := filepath.Join(util.DataDir, box.ID, ".siyuan", "sort.json")
	fullSortIDs, readErr := readSortConfMap(confPath)
	if nil != readErr {
		fileTreeSortLock.Unlock()
		return ret, readErr

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Open the target notebook in the notebook list
  2. Unlock the encrypted notebook before reordering
  3. Retry the drag after the notebook is available
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at kernel/model/file.go:2668 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/8eeddeea6e85abc5. Report an issue: GitHub.