siyuan-note/siyuan · warning

Conf.Language(126)

Error message

Conf.Language(126)

What it means

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.

Solutions

  1. Provide a non-empty, non-whitespace new name
  2. Guard the call site: skip or abort the rename when strings.TrimSpace(newName) == ""
  3. In UI, disable the confirm button until trimmed input is non-empty

Example fix

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

Strategy: validation

Validate before calling

if strings.TrimSpace(newName) == "" { return errors.New("bookmark name required") }

Try / catch

if err := model.RenameBookmark(old, name); err != nil {
  // show message; e.g. language key 126 localized text
}

Prevention

When it happens

Trigger: Calling RenameBookmark with newBookmark = "" or only spaces/tabs (e.g. user cleared the rename dialog field and confirmed).

Common situations: UI dialogs that don't disable the OK button on empty input; scripts passing an unset variable as the new name.

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@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/33b89f7fa9e736bf. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/bookmark.go:105

		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 9f775e8a12)