siyuan-note/siyuan · error
document block [%s] cannot be moved with block move; use doc
Error message
document block [%s] cannot be moved with block move; use document move instead
What it means
Thrown inside `validateBlockMove` when the block being moved has blocktree type `"d"` (document). SiYuan treats document blocks as notebook-level entities; relocating a document under another block via the block move transaction would create illegal nesting. The error routes the user to document-level move commands instead.
Source
Thrown at kernel/cli/cmd/block.go:440
}
if err := model.PerformTxSync(transaction); err != nil {
return err
}
if bt := treenode.GetBlockTree(id); bt != nil {
model.AppendPushReloadProtyleEntry(bt.RootID)
}
fmt.Println("ok")
return nil
},
}
func validateBlockMove(id, parentID, previousID string) error {
bt := treenode.GetBlockTree(id)
if nil == bt {
return fmt.Errorf("block not found: %s", id)
}
if "d" == bt.Type {
return fmt.Errorf("document block [%s] cannot be moved with block move; use document move instead", id)
}
if "" != previousID {
previousBt := treenode.GetBlockTree(previousID)
if nil == previousBt {
return fmt.Errorf("previous block not found: %s", previousID)
}
if "d" == previousBt.Type {
return fmt.Errorf("document block [%s] cannot be used as a previous sibling; use it as --parent instead", previousID)
}
return nil
}
if err := treenode.CheckListItemNesting(parentID, id); err != nil {
return err
}
return treenode.CheckContainerParent(parentID)
}
View on GitHub (pinned to 251596fc0d)
Solutions
- Use the document move API/command instead of `block move` for type-`d` blocks
- Confirm the block type first: `siyuan-kernel block get --id <id>` and check the Type field
- If you meant to move a child block inside the document, use that child's ID, not the document root ID
Example fix
// before siyuan-kernel block move --id 20260605100657-v080a4j # type 'd' // after # use the document move command for documents; use a non-document child block ID for block move
Defensive patterns
Strategy: validation
Validate before calling
// Reject document blocks before calling move.
bt := treenode.GetBlockTree(moverID)
if bt == nil {
return fmt.Errorf("mover block %s not found", moverID)
}
if bt.Type == "d" {
return fmt.Errorf("block %s is a document; use document move, not block move", moverID)
} Type guard
func isDocumentBlock(id string) bool {
bt := treenode.GetBlockTree(id)
return bt != nil && bt.Type == "d"
} Prevention
- Branch on block type in scripts: documents go to document-move, everything else to block-move
- Use `block get` to inspect Type before choosing the command
- Document IDs are often the same as file roots — flag them in tooling
When it happens
Trigger: Passing a document root block ID as `--id` to `block move`. Documents must be moved with the document/notebook move API, not the block move operation.
Common situations: Grabbing a document ID from the editor and using `block move`; assuming `block move` is generic for all block types; scripting doc reorganization with the wrong command.
Related errors
- document block [%s] cannot be used as a previous sibling; us
- block not found: %s
- previous block not found: %s
- --id is required
- document not found or empty
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/06152f5355fc3872.
Report an issue: GitHub.