{"record":{"id":"06152f5355fc3872","repo":"siyuan-note/siyuan","slug":"document-block-s-cannot-be-moved-with-block-mov","errorCode":null,"errorMessage":"document block [%s] cannot be moved with block move; use document move instead","messagePattern":"document block \\[(.+?)\\] cannot be moved with block move; use document move instead","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/block.go","lineNumber":456,"sourceCode":"\t\t}\n\t\tif err := model.PerformTxSync(transaction); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif bt := treenode.GetBlockTree(id); bt != nil {\n\t\t\tmodel.AppendPushReloadProtyleEntry(bt.RootID)\n\t\t}\n\t\tfmt.Println(\"ok\")\n\t\treturn nil\n\t},\n}\n\nfunc validateBlockMove(id, parentID, previousID string) error {\n\tbt := treenode.GetBlockTree(id)\n\tif nil == bt {\n\t\treturn fmt.Errorf(\"block not found: %s\", id)\n\t}\n\tif \"d\" == bt.Type {\n\t\treturn fmt.Errorf(\"document block [%s] cannot be moved with block move; use document move instead\", id)\n\t}\n\n\tif \"\" != previousID {\n\t\tpreviousBt := treenode.GetBlockTree(previousID)\n\t\tif nil == previousBt {\n\t\t\treturn fmt.Errorf(\"previous block not found: %s\", previousID)\n\t\t}\n\t\tif \"d\" == previousBt.Type {\n\t\t\treturn fmt.Errorf(\"document block [%s] cannot be used as a previous sibling; use it as --parent instead\", previousID)\n\t\t}\n\t\treturn nil\n\t}\n\tif err := treenode.CheckListItemNesting(parentID, id); err != nil {\n\t\treturn err\n\t}\n\treturn treenode.CheckContainerParent(parentID)\n}\n","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/cli/cmd/block.go#L438-L474","documentation":"The SiYuan CLI's block move command validates that the target ID is not a document block. Document blocks ('d' type in the block tree) cannot be re-parented via the generic block-move path; they have a dedicated document move command. This error is raised in validateBlockMove (kernel/cli/cmd/block.go:456) before any mutation occurs.","triggerScenarios":"Running a block move command (e.g. `siyuan block move --id <id> --parent <pid>`) where --id resolves to a document block. treenode.GetBlockTree(id) returns a block tree node whose Type is \"d\".","commonSituations":"Scripting bulk reorganization and passing a doc ID collected from a search or export instead of a child block ID; confusing the document ID (rootID) with an inner block ID; using the block move command on a top-level item clicked in the doc tree.","solutions":["Identify the document by its ID and use the document move command instead of the block move command","If the intent was to move a block within a document, resolve the actual inner block ID (not the doc/root ID) and retry","Check bt.Type via block info (`batch-get` or the API /api/block/getBlockInfo) before moving to confirm the target is not type 'd'"],"exampleFix":"// before\nsiyuan block move --id 20240101120000-abcdefg --parent 20240101120000-parent1\n// after (id is a document)\nsiyuan doc move --id 20240101120000-abcdefg --parent 20240101120000-parent1","handlingStrategy":"validation","validationCode":"info=$(siyuan block batch-get --ids \"$ID\")\ntype=$(echo \"$info\" | jq -r '.[0].type // empty')\nif [ \"$type\" = \"d\" ]; then\n  siyuan doc move --id \"$ID\" --parent \"$PARENT\"\nelse\n  siyuan block move --id \"$ID\" --parent \"$PARENT\"\nfi","typeGuard":"function isDocumentBlock(info) { return info && info.type === 'd'; }","tryCatchPattern":null,"preventionTips":["Fetch block info before any move and branch on the block type","Keep document IDs and block IDs in separate collections when scripting","Remember: rootID from search results is a document ID, not a movable block ID"],"tags":["cli","block-move","document-block","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}