siyuan-note/siyuan · error
--label is required
Error message
--label is required
What it means
`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.
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
Example fix
// before siyuan tag remove // after siyuan tag remove --label mytag
Defensive patterns
Strategy: validation
Validate before calling
if [ -z "$LABEL" ]; then echo "--label is required" >&2; exit 2; fi siyuan tag remove --label "$LABEL"
Try / catch
if ! siyuan tag remove --label "$LABEL"; then echo "tag remove failed; check the label exists" >&2 fi
Prevention
- Always pass --label explicitly; never rely on defaults
- Validate the variable feeding --label is non-empty
- List tags first to confirm exact spelling
When it happens
Trigger: Running `siyuan tag remove` without `--label`, or with `--label ""` (empty value).
Common situations: 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.
Understand the failure class
Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.
Related errors
- --new is required
- --old is required
- --av and --ids are required
- --av, --key, --item and --value are required
- --block is required for non-detached rows
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/779176418f495268.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/cli/cmd/tag.go:59
switch outputFormat {
case "json":
data, _ := json.MarshalIndent(tags, "", " ")
fmt.Println(string(data))
default:
printTagTable(tags)
}
return nil
},
}
var tagRemoveCmd = &cobra.Command{
Use: "remove --label <label>",
Short: "Remove a tag",
RunE: func(cmd *cobra.Command, args []string) error {
label, _ := cmd.Flags().GetString("label")
if label == "" {
return fmt.Errorf("--label is required")
}
if dryRun {
fmt.Printf("[dry-run] Would remove tag \"%s\"\n", label)
return nil
}
if err := model.RemoveTag(label); err != nil {
return err
}
model.AppendPushReloadTagEntry()
return nil
},
}
var tagRenameCmd = &cobra.Command{
Use: "rename --old <old-label> --new <new-label>",
Short: "Rename a tag",View on GitHub (pinned to 9f775e8a12)