siyuan-note/siyuan · error
--new is required
Error message
--new is required
What it means
Thrown by `bookmark rename` when `--new` (target) label is empty but `--old` is present. Both ends of a rename must be specified; without a target the model call `model.RenameBookmark` would be a no-op or ambiguous.
Source
Thrown at kernel/cli/cmd/bookmark.go:104
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
},
}
func printBookmarkTable(bookmarks *model.Bookmarks) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintln(w, "NAME\tCOUNT")View on GitHub (pinned to 251596fc0d)
Solutions
- Provide both labels: `siyuan bookmark rename --old "Inbox" --new "Archive"`
- Ensure the script that builds the command has a non-empty target value
- Confirm the new label does not collide with an existing bookmark
Example fix
// before siyuan bookmark rename --old "Inbox" // after siyuan bookmark rename --old "Inbox" --new "Archive"
Defensive patterns
Strategy: validation
Validate before calling
if strings.TrimSpace(newLabel) == "" {
log.Fatal("--new is required for bookmark rename")
} Prevention
- Validate both ends of a rename in one guard at the script level
- Check for label collisions before renaming
When it happens
Trigger: Running `siyuan bookmark rename --old "Inbox"` without `--new`, or with `--new ""`.
Common situations: User intends to rename but only names the source, or a script that sets the old label but leaves the new one blank due to a missing variable.
Related errors
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/a21a11547859a5e6.
Report an issue: GitHub.