{"record":{"id":"afb59e4d0d1d56ba","repo":"siyuan-note/siyuan","slug":"block-not-found-s","errorCode":null,"errorMessage":"block not found: %s","messagePattern":"block not found: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/block.go","lineNumber":437,"sourceCode":"\t\t\t\tParentID:   parentID,\n\t\t\t\tPreviousID: previousID,\n\t\t\t}},\n\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}","sourceCodeStart":419,"sourceCodeEnd":455,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/block.go#L419-L455","documentation":"Thrown inside `validateBlockMove(id, parentID, previousID)` when `treenode.GetBlockTree(id)` returns nil — the block to be moved is not present in the `blocktrees` SQLite table. `GetBlockTree` returns nil for unknown IDs, unmounted notebooks, encrypted-but-locked notebooks, and DB errors. This is a data-existence error, not an argument error.","triggerScenarios":"Passing an `--id` that does not exist in the current workspace; the block's notebook is closed; the blocktree DB is not yet populated (kernel still indexing); the ID was deleted.","commonSituations":"Stale block ID copied from another workspace; running the CLI before indexing completes; encrypted notebook not unlocked; typo or truncated ID.","solutions":["Confirm existence: `siyuan-kernel sql \"SELECT id,type FROM blocks WHERE id='<id>'\"`","Ensure the owning notebook is mounted/opened in this workspace","Unlock encrypted notebooks so the blocktree lookup (which falls back to per-box scan) can resolve them","Wait for kernel indexing to finish, then retry"],"exampleFix":"// before\nsiyuan-kernel block move --id 00000000000000-nonexist --parent <dest>\n// after\nsiyuan-kernel block move --id 20260605100657-v080a4j --parent <dest>  # verified via sql","handlingStrategy":"validation","validationCode":"// Confirm the mover block exists before attempting the move.\nbt := treenode.GetBlockTree(moverID)\nif bt == nil {\n    return fmt.Errorf(\"mover block %s not found; cannot move\", moverID)\n}","typeGuard":"func blockExists(id string) bool {\n    return strings.TrimSpace(id) != \"\" && treenode.GetBlockTree(id) != nil\n}","tryCatchPattern":null,"preventionTips":["Resolve the blocktree entry once and reuse it for type checks too (covers errors 176, 177)","Mount/unlock relevant notebooks before batch moves","Wait for indexing to finish before relying on blocktree lookups"],"tags":["cli","block","data-state","move","blocktree","go"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}