siyuan-note/siyuan · error

--id and --parent are required

Error message

--id and --parent are required

What it means

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.

Source

Thrown at kernel/cli/cmd/block.go:400

		model.FlushTxQueue()

		if bt != nil {
			model.AppendPushReloadProtyleEntry(bt.RootID)
		}
		fmt.Println(id)
		return nil
	},
}

var blockMoveCmd = &cobra.Command{
	Use:   "move --id <id> --parent <id>",
	Short: "Move block",
	RunE: func(cmd *cobra.Command, args []string) error {
		id, _ := cmd.Flags().GetString("id")
		parentID, _ := cmd.Flags().GetString("parent")
		previousID, _ := cmd.Flags().GetString("previous")
		if id == "" || parentID == "" {
			return fmt.Errorf("--id and --parent are required")
		}

		if err := validateBlockMove(id, parentID, previousID); err != nil {
			return err
		}

		if dryRun {
			fmt.Printf("[dry-run] Would move block %s to parent %s\n", id, parentID)
			if previousID != "" {
				fmt.Printf("         after previous sibling %s\n", previousID)
			}
			return nil
		}

		transaction := &model.Transaction{
			DoOperations: []*model.Operation{{
				Action:     "move",
				ID:         id,

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Supply both: `siyuan-kernel block move --id <mover> --parent <destination>`
  2. Optionally add `--previous <siblingID>` to position after a specific sibling
  3. Use `--dry-run` to preview the move before committing

Example fix

// before
siyuan-kernel block move --id 20260605100657-v080a4j
// after
siyuan-kernel block move --id 20260605100657-v080a4j --parent 20260605100658-dest123
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(moverID) == "" || strings.TrimSpace(parentID) == "" {
    return fmt.Errorf("`block move` requires both --id (mover) and --parent (destination)")
}
if err := validateBlockMove(moverID, parentID, previousID); err != nil {
    return err
}

Prevention

When it happens

Trigger: Running `siyuan-kernel block move` missing `--id`, missing `--parent`, or missing both. `--previous` is optional and not checked here.

Common situations: Forgetting the destination `--parent`; supplying only `--previous` and expecting it to imply the parent; confusing which ID is the mover vs the destination.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/827fb1703cb599e4. Report an issue: GitHub.