siyuan-note/siyuan · error

--old is required

Error message

--old is required

What it means

Thrown by `bookmark rename` when the `--old` (source) label is empty. The command renames an existing bookmark from `--old` to `--new`, so the original label is mandatory. This is checked before the `--new` requirement.

Source

Thrown at kernel/cli/cmd/bookmark.go:101

			return nil
		}

		if err := model.RemoveBookmark(label); err != nil {
			return err
		}
		model.AppendPushReloadFiletreeEntry()
		return nil
	},
}

var bookmarkRenameCmd = &cobra.Command{
	Use:   "rename --old <old> --new <new>",
	Short: "Rename a bookmark",
	RunE: func(cmd *cobra.Command, args []string) error {
		oldLabel, _ := cmd.Flags().GetString("old")
		newLabel, _ := cmd.Flags().GetString("new")
		if oldLabel == "" {
			return fmt.Errorf("--old is required")
		}
		if newLabel == "" {
			return fmt.Errorf("--new is required")
		}

		if dryRun {
			fmt.Printf("[dry-run] Would rename bookmark \"%s\" to \"%s\"\n", oldLabel, newLabel)
			return nil
		}

		if err := model.RenameBookmark(oldLabel, newLabel); err != nil {
			return err
		}
		model.AppendPushReloadFiletreeEntry()
		return nil
	},
}

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Supply the current label as `--old`: `siyuan bookmark rename --old "Inbox" --new "Archive"`
  2. Look up the exact existing label via the bookmark list/search command
  3. Remember both `--old` and `--new` are mandatory

Example fix

// before
siyuan bookmark rename --new "Archive"

// after
siyuan bookmark rename --old "Inbox" --new "Archive"
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(oldLabel) == "" {
    log.Fatal("--old is required for bookmark rename")
}

Prevention

When it happens

Trigger: Running `siyuan bookmark rename --new X` without `--old`, or with `--old ""`.

Common situations: Assuming only the new name is needed, or mixing up flag order expectations (cobra flags are order-independent, but both are required).

Related errors


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