{"record":{"id":"779176418f495268","repo":"siyuan-note/siyuan","slug":"label-is-required-779176","errorCode":null,"errorMessage":"--label is required","messagePattern":"--label is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/tag.go","lineNumber":59,"sourceCode":"\n\t\tswitch outputFormat {\n\t\tcase \"json\":\n\t\t\tdata, _ := json.MarshalIndent(tags, \"\", \"  \")\n\t\t\tfmt.Println(string(data))\n\t\tdefault:\n\t\t\tprintTagTable(tags)\n\t\t}\n\t\treturn nil\n\t},\n}\n\nvar tagRemoveCmd = &cobra.Command{\n\tUse:   \"remove --label <label>\",\n\tShort: \"Remove a tag\",\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 tag \\\"%s\\\"\\n\", label)\n\t\t\treturn nil\n\t\t}\n\n\t\tif err := model.RemoveTag(label); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmodel.AppendPushReloadTagEntry()\n\t\treturn nil\n\t},\n}\n\nvar tagRenameCmd = &cobra.Command{\n\tUse:   \"rename --old <old-label> --new <new-label>\",\n\tShort: \"Rename a tag\",","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/cli/cmd/tag.go#L41-L77","documentation":"`siyuan tag remove` requires the `--label` flag identifying which tag to remove. The command reads the flag with cmd.Flags().GetString and returns this error when it is empty or absent, since removing without a label would be ambiguous.","triggerScenarios":"Running `siyuan tag remove` without `--label`, or with `--label \"\"` (empty value).","commonSituations":"Copy-pasting an example command without filling in the label; a shell variable holding the tag name being empty due to a failed lookup or unset environment variable.","solutions":["Pass the tag: `siyuan tag remove --label mytag`","Check that the shell variable supplying the label is non-empty before invoking","Run `siyuan tag list` (or equivalent) to confirm the exact label text"],"exampleFix":"// before\nsiyuan tag remove\n// after\nsiyuan tag remove --label mytag","handlingStrategy":"validation","validationCode":"if [ -z \"$LABEL\" ]; then echo \"--label is required\" >&2; exit 2; fi\nsiyuan tag remove --label \"$LABEL\"","typeGuard":null,"tryCatchPattern":"if ! siyuan tag remove --label \"$LABEL\"; then\n  echo \"tag remove failed; check the label exists\" >&2\nfi","preventionTips":["Always pass --label explicitly; never rely on defaults","Validate the variable feeding --label is non-empty","List tags first to confirm exact spelling"],"tags":["cli","tag","missing-flag"],"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"}