siyuan-note/siyuan · error
Tag cannot be empty
Error message
Tag cannot be empty
What it means
After RenameTag trims leading/trailing '/' and whitespace from the new label, i18n key 114 ('Tag cannot be empty') is returned when nothing remains. Marker validation has already passed at this point, so input like '/', '//' or whitespace-only lands here; the rename is refused before any blocks are touched.
Source
Thrown at kernel/model/tag.go:136
updateAttributeViewBlockText(updateNodes)
sql.FlushQueue()
util.PushClearProgress()
return
}
func RenameTag(oldLabel, newLabel string) (err error) {
if invalidChar := treenode.ContainsMarker(newLabel); "" != invalidChar {
return fmt.Errorf(Conf.Language(112), invalidChar)
}
newLabel = strings.TrimPrefix(newLabel, "/")
newLabel = strings.TrimSuffix(newLabel, "/")
newLabel = strings.TrimSpace(newLabel)
if "" == newLabel {
return errors.New(Conf.Language(114))
}
if oldLabel == newLabel {
return
}
util.PushEndlessProgress(Conf.Language(110))
util.RandomSleep(500, 1000)
tags := sql.QueryTagSpansByLabel(oldLabel)
treeBlocks := map[string][]string{}
for _, tag := range tags {
if blocks, ok := treeBlocks[tag.RootID]; !ok {
treeBlocks[tag.RootID] = []string{tag.BlockID}
} else {
treeBlocks[tag.RootID] = append(blocks, tag.BlockID)
}
}View on GitHub (pinned to afa823b6b4)
Solutions
- Provide a real, non-empty label
- To remove a tag, delete the #tag markup from the blocks instead of renaming to empty
Example fix
// before
model.RenameTag("work", " /")
// after
model.RenameTag("work", "work-2026") Defensive patterns
Strategy: validation
Validate before calling
label := strings.TrimSpace(strings.TrimSuffix(strings.TrimPrefix(strings.TrimSpace(newLabel), "/"), "/"))
if label == "" {
return errors.New("tag label is empty after trimming")
}
model.RenameTag(oldLabel, label) Prevention
- Disable the rename confirm button while the trimmed label is empty
- Route 'delete tag' intents to removing the #tag markup, not renaming
When it happens
Trigger: Renaming a tag to '/', '//', or a blank/whitespace string; clearing the input field in the rename dialog.
Common situations: A user tries to 'delete' a tag by renaming it to empty — the supported way is removing the #tag markup from blocks.
Related errors
- Do not include Markdown syntax marker [%s]
- Conf.Language(114)
- Do not include symbols \ / : * ? " ' < > |
- block write failed: empty block ID
- Conf.Language(151) (localized invalid filename message)
AI-assisted analysis of siyuan-note/siyuan@afa823b6b4 (2026-08-18).
Data as JSON: /api/errors/cb7664f5adfef6f8.
Report an issue: GitHub.