siyuan-note/siyuan · error
Bookmark cannot be empty
Error message
Bookmark cannot be empty
What it means
In RenameBookmark, after the marker check (error 529) passes, the name is TrimSpace'd and if empty the function returns errors.New(Conf.Language(126)) — 'Bookmark cannot be empty'. Note the ordering: a name that consists only of whitespace plus a marker character hits error 529 first; only whitespace/marker-free emptiness reaches this check. A no-op rename (old == new) returns nil after this.
Source
Thrown at kernel/model/bookmark.go:103
util.RandomSleep(50, 150)
}
indexHistoryDir(filepath.Base(historyDir), util.NewLute())
sql.FlushQueue()
util.ReloadUI()
return
}
func RenameBookmark(oldBookmark, newBookmark string) (err error) {
if invalidChar := treenode.ContainsMarker(newBookmark); "" != invalidChar {
return fmt.Errorf(Conf.Language(112), invalidChar)
}
newBookmark = strings.TrimSpace(newBookmark)
if "" == newBookmark {
return errors.New(Conf.Language(126))
}
if oldBookmark == newBookmark {
return
}
util.PushEndlessProgress(Conf.Language(110))
defer util.ClearPushProgress(100)
bookmarks := sql.QueryBookmarkBlocks()
treeBlocks := map[string][]string{}
for _, bm := range bookmarks {
if blocks, ok := treeBlocks[bm.RootID]; !ok {
treeBlocks[bm.RootID] = []string{bm.ID}
} else {
treeBlocks[bm.RootID] = append(blocks, bm.ID)
}
}View on GitHub (pinned to 251596fc0d)
Solutions
- To delete a bookmark, use the remove/disband bookmark flow, not an empty rename.
- Validate newBookmark is non-empty after TrimSpace on the client before calling.
- Disable the rename confirm button while the input is blank.
Example fix
// before
fetchPost('/api/bookmark/renameBookmark', {oldBookmark, newBookmark: ''})
// after: reject empty up front; remove via the proper flow when intended
const name = newBookmark.trim()
if (!name) { showMessage(window.siyuan.languages['_kernel'][126]); return }
fetchPost('/api/bookmark/renameBookmark', {oldBookmark, newBookmark: name}) Defensive patterns
Strategy: validation
Validate before calling
// Reject empty (marker-free) names on the client; use the remove flow to delete.
name := strings.TrimSpace(newBookmark)
if name == "" {
return errors.New("bookmark name required; use remove bookmark to delete")
} Try / catch
// HTTP caller: disable submit while the trimmed input is empty.
if (!newBookmark.trim()) { showMessage(emptyMsg); return } Prevention
- Provide a separate 'remove bookmark' action rather than rename-to-empty.
- Disable the confirm button while the input is blank.
When it happens
Trigger: POST /api/bookmark/renameBookmark with newBookmark being empty, only spaces, or only tabs/newlines (and containing no Markdown marker chars).
Common situations: UI submitting an empty input field; programmatic caller passing '' to 'clear' a bookmark (renaming-to-empty is not how you remove one); trimming user input down to nothing.
Related errors
- Encrypted notebooks do not support this operation
- Do not include Markdown syntax marker [%s]
- Failed to update agent session permission
- Agent capability name and description are required
- invalid frontend capability ID: %s
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/1f94c7e08043e391.
Report an issue: GitHub.