siyuan-note/siyuan · warning
Conf.Language(151)
Error message
Conf.Language(151)
What it means
The TagSnapshot function rejects a tag name that fails the gulu.File.IsValidFilename check, meaning it contains characters invalid for filesystem filenames (e.g., path separators, null bytes, or OS-reserved names on Windows like CON, PRN). The Language(151) string is the 'invalid filename' message. This guard fires after the empty-name check.
Source
Thrown at kernel/model/repository.go:1653
err = repo.RemoveTag(tag)
return
}
func TagSnapshot(id, name string) (err error) {
if 1 > len(Conf.Repo.Key) {
err = errors.New(Conf.Language(26))
return
}
name = util.RemoveInvalid(name)
name = strings.TrimSpace(name)
if "" == name {
err = errors.New(Conf.Language(142))
return
}
if !gulu.File.IsValidFilename(name) {
err = errors.New(Conf.Language(151))
return
}
repo, err := newRepository()
if err != nil {
return
}
index, err := repo.GetIndex(id)
if err != nil {
return
}
if err = repo.AddTag(index.ID, name); err != nil {
msg := fmt.Sprintf("Add tag to data snapshot [%s] failed: %s", index.ID, err)
util.PushStatusBar(msg)
return
}View on GitHub (pinned to 251596fc0d)
Solutions
- Remove or replace invalid filename characters from the tag name before calling TagSnapshot
- Use alphanumeric characters, hyphens, and underscores as a safe naming convention
- Run the name through gulu.File.IsValidFilename on the client side before submitting
Example fix
// before
model.TagSnapshot(id, "feature/v2:final")
// after
name = strings.Map(func(r rune) rune {
if gulu.File.IsValidFilename(string(r)) {
return r
}
return '-'
}, name)
model.TagSnapshot(id, name) Defensive patterns
Strategy: validation
Validate before calling
// Validate filename before calling TagSnapshot
if !gulu.File.IsValidFilename(name) {
return errors.New("tag name contains invalid characters")
} Type guard
// Check if a string is a valid filename for tagging
func isValidTagName(name string) bool {
name = strings.TrimSpace(name)
if name == "" {
return false
}
return gulu.File.IsValidFilename(name)
} Prevention
- Run client-side filename validation that mirrors gulu.File.IsValidFilename
- Provide visual feedback (red border, error tooltip) when the user enters invalid characters
- Suggest a sanitized version of the name (e.g., replacing slashes with hyphens) as an auto-fix
When it happens
Trigger: Calling TagSnapshot(id, name) where the name contains characters like forward slashes, backslashes, colons, asterisks, question marks, angle brackets, pipe characters, or is a reserved filename on the target OS. The gulu.File.IsValidFilename function performs platform-aware validation.
Common situations: A user includes special characters in a tag name (e.g., 'feature/v2', 'backup:2024', 'Q&A'). On Windows, names like 'CON' or 'LPT1' are reserved. This is common when tag names are auto-generated from content that includes punctuation.
Related errors
- Conf.Language(142)
- invalid custom emoji name
- Do not include symbols \ / : * ? " ' < > |
- Activation code cannot be empty
- invalid notebook ID
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/97994a7f456ebac9.
Report an issue: GitHub.