{"record":{"id":"a21a11547859a5e6","repo":"siyuan-note/siyuan","slug":"new-is-required","errorCode":null,"errorMessage":"--new is required","messagePattern":"--new is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/bookmark.go","lineNumber":104,"sourceCode":"\t\tif err := model.RemoveBookmark(label); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmodel.AppendPushReloadFiletreeEntry()\n\t\treturn nil\n\t},\n}\n\nvar bookmarkRenameCmd = &cobra.Command{\n\tUse:   \"rename --old <old> --new <new>\",\n\tShort: \"Rename a bookmark\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\toldLabel, _ := cmd.Flags().GetString(\"old\")\n\t\tnewLabel, _ := cmd.Flags().GetString(\"new\")\n\t\tif oldLabel == \"\" {\n\t\t\treturn fmt.Errorf(\"--old is required\")\n\t\t}\n\t\tif newLabel == \"\" {\n\t\t\treturn fmt.Errorf(\"--new is required\")\n\t\t}\n\n\t\tif dryRun {\n\t\t\tfmt.Printf(\"[dry-run] Would rename bookmark \\\"%s\\\" to \\\"%s\\\"\\n\", oldLabel, newLabel)\n\t\t\treturn nil\n\t\t}\n\n\t\tif err := model.RenameBookmark(oldLabel, newLabel); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmodel.AppendPushReloadFiletreeEntry()\n\t\treturn nil\n\t},\n}\n\nfunc printBookmarkTable(bookmarks *model.Bookmarks) {\n\tw := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)\n\tfmt.Fprintln(w, \"NAME\\tCOUNT\")","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/bookmark.go#L86-L122","documentation":"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.","triggerScenarios":"Running `siyuan bookmark rename --old \"Inbox\"` without `--new`, or with `--new \"\"`.","commonSituations":"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.","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"],"exampleFix":"// before\nsiyuan bookmark rename --old \"Inbox\"\n\n// after\nsiyuan bookmark rename --old \"Inbox\" --new \"Archive\"","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(newLabel) == \"\" {\n    log.Fatal(\"--new is required for bookmark rename\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate both ends of a rename in one guard at the script level","Check for label collisions before renaming"],"tags":["cli","bookmark","flag-validation","argument-required"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}