{"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/9f775e8a12daef8255556097396f9b2739078892/kernel/cli/cmd/bookmark.go#L83-L119","documentation":"The `bookmark rename` command requires both --old (current label) and --new (new label). This error fires when --old is missing or empty (kernel/cli/cmd/bookmark.go:101), before model.RenameBookmark runs.","triggerScenarios":"Running `bookmark rename --new \"New\"` without --old, or with `--old \"\"`; misspelling the flag so the empty default is read.","commonSituations":"Renaming bookmarks in bulk scripts where the old-label variable is unset; only partially updating a command line after copying the rename example; confusing this rename with attribute/attribute-view rename commands that use different flags.","solutions":["Provide both flags: bookmark rename --old \"OldLabel\" --new \"NewLabel\"","List bookmarks first to confirm the exact current label used as --old","In scripts, validate both variables are non-empty before invoking the command"],"exampleFix":"// before\nsiyuan bookmark rename --new \"Important\"\n// after\nsiyuan bookmark rename --old \"TODO\" --new \"Important\"","handlingStrategy":"validation","validationCode":"if [ -z \"$OLD\" ] || [ -z \"$NEW\" ]; then echo \"both --old and --new are required\" >&2; exit 1; fi\nsiyuan bookmark rename --old \"$OLD\" --new \"$NEW\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass both --old and --new together","Source --old from a fresh bookmark list, not memory","Validate variables in bulk-rename scripts before the loop starts"],"tags":["cli","missing-flag","bookmark","rename"],"backgroundTag":"missing-required-flag","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}