{"record":{"id":"967cd4802ae2e1e8","repo":"siyuan-note/siyuan","slug":"old-is-required","errorCode":null,"errorMessage":"--old is required","messagePattern":"--old is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/bookmark.go","lineNumber":101,"sourceCode":"\t\t\treturn nil\n\t\t}\n\n\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","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/bookmark.go#L83-L119","documentation":"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.","triggerScenarios":"Running `siyuan bookmark rename --new X` without `--old`, or with `--old \"\"`.","commonSituations":"Assuming only the new name is needed, or mixing up flag order expectations (cobra flags are order-independent, but both are required).","solutions":["Supply the current label as `--old`: `siyuan bookmark rename --old \"Inbox\" --new \"Archive\"`","Look up the exact existing label via the bookmark list/search command","Remember both `--old` and `--new` are mandatory"],"exampleFix":"// before\nsiyuan bookmark rename --new \"Archive\"\n\n// after\nsiyuan bookmark rename --old \"Inbox\" --new \"Archive\"","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(oldLabel) == \"\" {\n    log.Fatal(\"--old is required for bookmark rename\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always specify both --old and --new together","Copy the source label verbatim from the bookmark list"],"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"}