siyuan-note/siyuan · error
source document [ ] is not a sibling of target document [ ]
Error message
source document [%s] is not a sibling of target document [%s]
What it means
Documents can only be reordered among their siblings: every source must be in the same notebook (source.BoxID == target.BoxID) and in the same parent directory (path.Dir(source.Path) == parentPath). If any source violates this, the reorder is rejected. This keeps the operation a pure reordering within one parent rather than a move between parents.
Solutions
- Group source documents by their parent document and issue one reorder call per sibling group
- Use the document move API instead when the intent is to relocate documents across parents/notebooks
- Verify each source's notebook and parent path match the target's before calling
- Fix the drag-and-drop logic so cross-parent drops trigger move, not reorder
Example fix
// before reorderDocs(mixedIDs, targetID, "after") // sources span parents // after const siblings = mixedIDs.filter(id => parentOf(id) === parentOf(targetID)) reorderDocs(siblings, targetID, "after")
Defensive patterns
Strategy: validation
Validate before calling
const targetParent = parentPathOf(targetID)
const siblings = sourceIDs.filter(id => notebookOf(id) === target.notebookId && parentPathOf(id) === targetParent)
if (siblings.length !== sourceIDs.length) { /* route non-siblings to the move API instead */ } Try / catch
try { await api.reorderDocs(src, targetID, pos) } catch (e) { if (String(e).includes("is not a sibling")) { await api.moveDocs(src, targetParentDocID); return retryOnce() } throw e } Prevention
- Group reorder requests strictly by parent document
- Use the move API for anything crossing notebooks or parents
- Enforce same-parent drops in drag-and-drop handlers (disable cross-level drop indicators)
When it happens
Trigger: Passing source documents from a different notebook than the target; passing sources whose parent is a different document/folder than the target's parent (e.g. dragging across levels in the file tree).
Common situations: UI or plugin drag-and-drop implementations allowing cross-level drops; mixing IDs from search results spanning multiple parents; assuming reorder can substitute for a move operation.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- block [ ] is not a document
- block [ ] is not a document that can declare a child…
- source document [ ] not found
- target document [ ] not found
- boot appearance asset forbidden
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/8deb5fb6163a6882.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/file.go:2701
}
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
}
currentIDs, loadErr := loadSiblingCustomOrder(box.ID, parentPath, fullSortIDs)
if nil != loadErr {
fileTreeSortLock.Unlock()
return ret, loadErr
}
orderedIDs, changed, reorderErr := reorderIDSequence(currentIDs, sourceIDs, targetID, position)
if nil != reorderErr || !changed {
fileTreeSortLock.Unlock()View on GitHub (pinned to 9f775e8a12)