siyuan-note/siyuan · error
Do not include symbols \ / : * ? " ' < > |
Error message
Do not include symbols \ / : * ? " ' < > |
What it means
After the empty check, TagSnapshot validates the name with gulu.File.IsValidFilename; names containing filesystem-invalid symbols \ / : * ? " ' < > | are rejected with errors.New(Conf.Language(151)). This is because tags map to snapshot directory/file names on disk and in cloud storage, so OS-illegal characters would break the repo layout.
Solutions
- Remove or replace the forbidden characters (\ / : * ? " ' < > |) from the tag name before calling TagSnapshot
- Rely on util.RemoveInvalid then verify the result with gulu.File.IsValidFilename on the caller side to fail fast
- Use letters, digits, spaces, hyphens and underscores, which pass filename validation on all platforms
- If the message is Language 151, the repo key is fine — only the name needs fixing; no other state must change
Example fix
// before
name := "backup: 2024/05"
model.TagSnapshot(id, name) // fails: contains ':' and '/'
// after
name := "backup: 2024/05"
name = strings.Map(func(r rune) rune {
if strings.ContainsRune(`\/:*?"'<>|`, r) { return '-' }
return r
}, name)
model.TagSnapshot(id, name) Defensive patterns
Strategy: validation
Validate before calling
function isValidTagName(name) {
return name.length > 0 && !/[\\/:*?"'<>|]/.test(name);
}
// call before TagSnapshot
if (!isValidTagName(input)) throw new Error('Do not include symbols \\ / : * ? " \' < > |'); Try / catch
try {
await fetchPost('/api/repo/tagSnapshot', {id, name});
} catch (e) {
if (e.msg.includes('Do not include symbols')) highlightInvalidCharsInInput();
} Prevention
- Filter or replace \ / : * ? " ' < > | in the input field as the user types
- Reuse the kernel's rule (gulu.File.IsValidFilename semantics) in client-side validation
- Prefer letters, digits, spaces, hyphens, underscores for tag names
- Show the allowed-character rule next to the tag input to prevent the error entirely
When it happens
Trigger: Calling TagSnapshot with a name containing any of \ / : * ? " ' < > | that survives util.RemoveInvalid, so gulu.File.IsValidFilename fails and Language 151 is returned.
Common situations: Users typing tags like 'backup 2024/05' or using OS path separators; names derived from document titles that contain colons or quotes; automation passing raw filenames with Windows-illegal characters.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- Conf.Language(151)
- Input can not be empty
- Cannot create a file starting with .
- Conf.Language(142)
- Conf.Language(151)
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/d3709f691edd32cb.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/repository.go:1733
}
func TagSnapshot(id, name string) (err error) {
assetDownloadSourceMu.RLock()
defer assetDownloadSourceMu.RUnlock()
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 := newRepositoryWithAssetSourceLocked()
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 9f775e8a12)