{"record":{"id":"827fb1703cb599e4","repo":"siyuan-note/siyuan","slug":"id-and-parent-are-required","errorCode":null,"errorMessage":"--id and --parent are required","messagePattern":"--id and --parent are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/block.go","lineNumber":400,"sourceCode":"\t\tmodel.FlushTxQueue()\n\n\t\tif bt != nil {\n\t\t\tmodel.AppendPushReloadProtyleEntry(bt.RootID)\n\t\t}\n\t\tfmt.Println(id)\n\t\treturn nil\n\t},\n}\n\nvar blockMoveCmd = &cobra.Command{\n\tUse:   \"move --id <id> --parent <id>\",\n\tShort: \"Move block\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tid, _ := cmd.Flags().GetString(\"id\")\n\t\tparentID, _ := cmd.Flags().GetString(\"parent\")\n\t\tpreviousID, _ := cmd.Flags().GetString(\"previous\")\n\t\tif id == \"\" || parentID == \"\" {\n\t\t\treturn fmt.Errorf(\"--id and --parent are required\")\n\t\t}\n\n\t\tif err := validateBlockMove(id, parentID, previousID); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif dryRun {\n\t\t\tfmt.Printf(\"[dry-run] Would move block %s to parent %s\\n\", id, parentID)\n\t\t\tif previousID != \"\" {\n\t\t\t\tfmt.Printf(\"         after previous sibling %s\\n\", previousID)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\ttransaction := &model.Transaction{\n\t\t\tDoOperations: []*model.Operation{{\n\t\t\t\tAction:     \"move\",\n\t\t\t\tID:         id,","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/block.go#L382-L418","documentation":"Thrown by the `block move` subcommand when EITHER `--id` or `--parent` is empty (`id == \"\" || parentID == \"\"`). Move relocates block `--id` under `--parent`, optionally after `--previous`. Both the moved block and the destination must be specified up front.","triggerScenarios":"Running `siyuan-kernel block move` missing `--id`, missing `--parent`, or missing both. `--previous` is optional and not checked here.","commonSituations":"Forgetting the destination `--parent`; supplying only `--previous` and expecting it to imply the parent; confusing which ID is the mover vs the destination.","solutions":["Supply both: `siyuan-kernel block move --id <mover> --parent <destination>`","Optionally add `--previous <siblingID>` to position after a specific sibling","Use `--dry-run` to preview the move before committing"],"exampleFix":"// before\nsiyuan-kernel block move --id 20260605100657-v080a4j\n// after\nsiyuan-kernel block move --id 20260605100657-v080a4j --parent 20260605100658-dest123","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(moverID) == \"\" || strings.TrimSpace(parentID) == \"\" {\n    return fmt.Errorf(\"`block move` requires both --id (mover) and --parent (destination)\")\n}\nif err := validateBlockMove(moverID, parentID, previousID); err != nil {\n    return err\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat `--id` and `--parent` as an inseparable pair for move","Call `validateBlockMove` in your own code to catch structural problems early","Dry-run moves before committing in batch scripts"],"tags":["cli","block","argument-validation","write","go"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}