siyuan-note/siyuan · error

Conf.Language(126) (localized empty-bookmark-name message)

Error message

Conf.Language(126) (localized empty-bookmark-name message)

What it means

A bookmark rename resolves to an empty name after trimming whitespace, which is not allowed because a bookmark must have a non-empty label. The localized empty-name message (Conf.Language(126)) is returned. Note the marker check runs before trimming, and the emptiness check runs after strings.TrimSpace, so a name of only spaces also lands here.

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 8641553a1f)

Solutions

  1. Provide a non-empty new bookmark name.
  2. To remove a bookmark, call the dedicated remove/delete bookmark API instead of renaming to empty.
  3. Validate client-side: trim the input and require length > 0 before invoking the API.
  4. Show Conf.Language(126) in the UI to prompt the user for a valid name.

Example fix

// before
err := model.RenameBookmark(old, "")
// after
name := strings.TrimSpace(input)
if name == "" { return errors.New("bookmark name required") }
err := model.RenameBookmark(old, name)
Defensive patterns

Strategy: validation

Validate before calling

function isValidBookmarkName(name) { return typeof name === 'string' && name.trim().length > 0 }

Prevention

When it happens

Trigger: Calling RenameBookmark with newBookmark == "" or a whitespace-only string (e.g. " "); the rename dialog submitted with a cleared input field.

Common situations: User deletes all text in the rename input and confirms; automation scripts pass an empty string to clear a bookmark instead of using the proper remove-bookmark API.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/de191164a4d60c62. Report an issue: GitHub.