{"record":{"id":"89a6d4680c6de3b5","repo":"siyuan-note/siyuan","slug":"label-is-required","errorCode":null,"errorMessage":"--label is required","messagePattern":"--label is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/bookmark.go","lineNumber":78,"sourceCode":"\t\tdefault:\n\t\t\tw := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)\n\t\t\tfmt.Fprintln(w, \"LABEL\")\n\t\t\tfor _, l := range labels {\n\t\t\t\tfmt.Fprintln(w, l)\n\t\t\t}\n\t\t\tw.Flush()\n\t\t}\n\t\treturn nil\n\t},\n}\n\nvar bookmarkRemoveCmd = &cobra.Command{\n\tUse:   \"remove --label <label>\",\n\tShort: \"Remove a bookmark\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tlabel, _ := cmd.Flags().GetString(\"label\")\n\t\tif label == \"\" {\n\t\t\treturn fmt.Errorf(\"--label is required\")\n\t\t}\n\n\t\tif dryRun {\n\t\t\tfmt.Printf(\"[dry-run] Would remove bookmark \\\"%s\\\"\\n\", label)\n\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\",","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/bookmark.go#L60-L96","documentation":"Thrown by the `bookmark remove` cobra subcommand when the `--label` flag is empty. Bookmarks in SiYuan are keyed by a label string, so removing one requires the exact label. The guard runs before any model mutation (`model.RemoveBookmark`).","triggerScenarios":"Running `siyuan bookmark remove` without `--label`, or with an empty value, or before dry-run handling.","commonSituations":"Forgetting the label, mistyping as `--name`, or copying a label with trailing whitespace that the shell strips.","solutions":["List existing bookmarks first (e.g. via the bookmark search/list command or `siyuan bookmark list`) to copy the exact label","Pass the label verbatim: `siyuan bookmark remove --label \"我的书签\"`","Confirm the flag is `--label`, not `--name`/`--bookmark`"],"exampleFix":"// before\nsiyuan bookmark remove\n\n// after\nsiyuan bookmark remove --label \"Inbox\"","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(label) == \"\" {\n    log.Fatal(\"--label is required to remove a bookmark\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fetch the exact label from the bookmark list before removing","Use --dry-run to confirm the label resolves to the intended bookmark"],"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"}