{"record":{"id":"274ba0d4ab9857e7","repo":"siyuan-note/siyuan","slug":"conf-language-142","errorCode":null,"errorMessage":"Conf.Language(142)","messagePattern":"Conf\\.Language\\(142\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kernel/model/repository.go","lineNumber":1648,"sourceCode":"\trepo, err := newRepository()\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = repo.RemoveTag(tag)\n\treturn\n}\n\nfunc TagSnapshot(id, name string) (err error) {\n\tif 1 > len(Conf.Repo.Key) {\n\t\terr = errors.New(Conf.Language(26))\n\t\treturn\n\t}\n\n\tname = util.RemoveInvalid(name)\n\tname = strings.TrimSpace(name)\n\tif \"\" == name {\n\t\terr = errors.New(Conf.Language(142))\n\t\treturn\n\t}\n\n\tif !gulu.File.IsValidFilename(name) {\n\t\terr = errors.New(Conf.Language(151))\n\t\treturn\n\t}\n\n\trepo, err := newRepository()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tindex, err := repo.GetIndex(id)\n\tif err != nil {\n\t\treturn\n\t}\n","sourceCodeStart":1630,"sourceCodeEnd":1666,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/repository.go#L1630-L1666","documentation":"The TagSnapshot function rejects a tag name that is empty after removing invisible characters and trimming whitespace. The Language(142) string is the validation message for an empty required field. This guard fires after the repo key check but before the filename validity check.","triggerScenarios":"Calling TagSnapshot(id, name) where name is an empty string, contains only whitespace, or contains only invisible/control characters that util.RemoveInvalid strips out. The trimmed result is compared against an empty string and the error is returned.","commonSituations":"Frontend bug where the tag name input field is not properly validated before the API call. Also occurs when a user accidentally submits with whitespace-only input, or when an automation/plugin passes an empty or malformed name string.","solutions":["Provide a non-empty tag name after trimming whitespace","Validate the name on the frontend before submitting the API request","Ensure no invisible characters are in the input by running it through util.RemoveInvalid or equivalent client-side sanitization"],"exampleFix":"// before\nmodel.TagSnapshot(id, \"   \")\n\n// after\nname = strings.TrimSpace(name)\nif name == \"\" {\n    return errors.New(\"tag name is required\")\n}\nmodel.TagSnapshot(id, name)","handlingStrategy":"validation","validationCode":"// Validate tag name before calling TagSnapshot\nname = strings.TrimSpace(name)\nif name == \"\" {\n    return errors.New(\"tag name must not be empty\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Trim and validate the tag name field in the frontend input component before form submission","Disable the submit button when the tag name field is empty or whitespace-only","Use HTML required attribute and client-side validation for the tag name input"],"tags":["validation","snapshot","input","empty-field"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}