{"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/9f775e8a12daef8255556097396f9b2739078892/kernel/cli/cmd/bookmark.go#L60-L96","documentation":"The `bookmark remove` CLI command requires the --label flag identifying which bookmark to delete. When the flag is missing or empty, RunE returns this error (kernel/cli/cmd/bookmark.go:78) before calling model.RemoveBookmark.","triggerScenarios":"Running `siyuan bookmark remove` without --label, with `--label \"\"`, or with a misspelled flag so GetString returns the empty default.","commonSituations":"Interactive shell line-editing dropping the flag; scripts where the bookmark label variable is empty; assuming the label is a positional argument.","solutions":["Pass the exact bookmark label: --label \"MyBookmark\"","List existing bookmarks first (bookmark list) to get the exact label, including case and whitespace","Check flag spelling (--label, not --name or --bookmark)"],"exampleFix":"// before\nsiyuan bookmark remove\n// after\nsiyuan bookmark remove --label \"TODO\"","handlingStrategy":"validation","validationCode":"if [ -z \"$LABEL\" ]; then echo \"--label is required\" >&2; exit 1; fi\nsiyuan bookmark remove --label \"$LABEL\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass --label explicitly with the exact bookmark text","Look up exact labels via bookmark list before removing","Use --dry-run first to confirm the target bookmark"],"tags":["cli","missing-flag","bookmark"],"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"}