{"record":{"id":"33b89f7fa9e736bf","repo":"siyuan-note/siyuan","slug":"conf-language-126","errorCode":null,"errorMessage":"Conf.Language(126)","messagePattern":"Conf\\.Language\\(126\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kernel/model/bookmark.go","lineNumber":105,"sourceCode":"\n\t\tutil.RandomSleep(50, 150)\n\t}\n\n\tindexHistoryDir(filepath.Base(historyDir), util.NewLute())\n\tsql.FlushQueue()\n\n\tutil.ReloadUI()\n\treturn\n}\n\nfunc RenameBookmark(oldBookmark, newBookmark string) (err error) {\n\tif invalidChar := treenode.ContainsMarker(newBookmark); \"\" != invalidChar {\n\t\treturn fmt.Errorf(Conf.Language(112), invalidChar)\n\t}\n\n\tnewBookmark = strings.TrimSpace(newBookmark)\n\tif \"\" == newBookmark {\n\t\treturn errors.New(Conf.Language(126))\n\t}\n\n\tif oldBookmark == newBookmark {\n\t\treturn\n\t}\n\n\tutil.PushEndlessProgress(Conf.Language(110))\n\tdefer util.ClearPushProgress(100)\n\n\tbookmarks := sql.QueryBookmarkBlocks()\n\ttreeBlocks := map[string][]string{}\n\tfor _, bm := range bookmarks {\n\t\tif blocks, ok := treeBlocks[bm.RootID]; !ok {\n\t\t\ttreeBlocks[bm.RootID] = []string{bm.ID}\n\t\t} else {\n\t\t\ttreeBlocks[bm.RootID] = append(blocks, bm.ID)\n\t\t}\n\t}","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/bookmark.go#L87-L123","documentation":"RenameBookmark rejects an empty new bookmark name with a localized 'empty name' error (language key 126). After trimming surrounding whitespace, a name that is empty or whitespace-only cannot identify a bookmark group, so the operation is refused.","triggerScenarios":"Calling RenameBookmark with newBookmark = \"\" or only spaces/tabs (e.g. user cleared the rename dialog field and confirmed).","commonSituations":"UI dialogs that don't disable the OK button on empty input; scripts passing an unset variable as the new name.","solutions":["Provide a non-empty, non-whitespace new name","Guard the call site: skip or abort the rename when strings.TrimSpace(newName) == \"\"","In UI, disable the confirm button until trimmed input is non-empty"],"exampleFix":"// before\nif err := model.RenameBookmark(old, name); err != nil { return err }\n// after\nname = strings.TrimSpace(name)\nif name == \"\" { return errors.New(\"bookmark name required\") }\nif err := model.RenameBookmark(old, name); err != nil { return err }","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(newName) == \"\" { return errors.New(\"bookmark name required\") }","typeGuard":null,"tryCatchPattern":"if err := model.RenameBookmark(old, name); err != nil {\n  // show message; e.g. language key 126 localized text\n}","preventionTips":["Disable confirm buttons until trimmed input is non-empty","Trim input at the call site before invoking the API","Treat whitespace-only input as empty everywhere"],"tags":["go","kernel","bookmark","empty-input"],"backgroundTag":"empty-required-field","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}