{"record":{"id":"c5f724d55db2956d","repo":"siyuan-note/siyuan","slug":"previous-block-not-found-s","errorCode":null,"errorMessage":"previous block not found: %s","messagePattern":"previous block not found: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/block.go","lineNumber":446,"sourceCode":"\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\nvar blockBatchGetCmd = &cobra.Command{\n\tUse:   \"batch-get --ids id1,id2,...\",\n\tShort: \"Batch get block info\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tidsStr, _ := cmd.Flags().GetString(\"ids\")\n\t\tif idsStr == \"\" {","sourceCodeStart":428,"sourceCodeEnd":464,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/block.go#L428-L464","documentation":"Thrown inside `validateBlockMove` when `--previous` is provided but `treenode.GetBlockTree(previousID)` returns nil. The previous-sibling anchor must exist in the blocktree so the transaction can position the moved block after it. Same nil-return conditions as error [176] apply.","triggerScenarios":"Passing `--previous <id>` where that ID is unknown, deleted, in an unmounted notebook, or in a locked encrypted notebook.","commonSituations":"Typo in the previous-sibling ID; sibling was deleted between planning and executing the move; sibling lives in a closed notebook.","solutions":["Verify the previous ID exists: `siyuan-kernel sql \"SELECT id FROM blocks WHERE id='<previousID>'\"`","Drop `--previous` if you do not need sibling-anchored placement — the move will then use parent + nesting checks instead","Ensure the sibling's notebook is mounted/unlocked"],"exampleFix":"// before\nsiyuan-kernel block move --id <mover> --parent <dest> --previous 00000000000000-x\n// after\nsiyuan-kernel block move --id <mover> --parent <dest>  # omit --previous, or pass a verified sibling ID","handlingStrategy":"validation","validationCode":"// Only set --previous when the sibling actually exists.\nif previousID != \"\" {\n    if treenode.GetBlockTree(previousID) == nil {\n        return fmt.Errorf(\"previous sibling %s not found\", previousID)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit `--previous` when sibling positioning is not required","Validate the sibling ID the same way you validate the mover ID","Re-verify sibling IDs if the workspace changed between planning and executing"],"tags":["cli","block","move","data-state","blocktree","go"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}