siyuan-note/siyuan · error

Conf.Language(112) formatted with invalidChar (localized mar

Error message

Conf.Language(112) formatted with invalidChar (localized marker-not-allowed message)

What it means

Renaming a bookmark to a name containing reserved Markdown/markup marker characters is rejected. treenode.ContainsMarker scans the new name for characters that would be interpreted as block markers and returns the offending character, which is interpolated into the localized message Conf.Language(112). This protects document structure from names that would corrupt rendering when used as block text.

Source

Thrown at kernel/model/bookmark.go:98

			if err = writeTreeUpsertQueue(tree); err != nil {
				util.ClearPushProgress(100)
				return
			}
		}

		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 {

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Remove marker characters from the new bookmark name before calling the API.
  2. Strip or escape markers client-side using the same character set as treenode.ContainsMarker.
  3. Show the localized message (Conf.Language(112)) to the user and prompt for a different name.
  4. In automation, sanitize names with a regexp removing marker characters.

Example fix

// before
err := model.RenameBookmark(old, "[Important] notes")
// after
safe := strings.Map(func(r rune) rune {
    if strings.ContainsRune("[](){}#*`_~", r) { return -1 }
    return r
}, "[Important] notes")
err := model.RenameBookmark(old, safe)
Defensive patterns

Strategy: validation

Validate before calling

function hasMarkerChars(name) { return /[](){}#*`_~]/.test(name) }

Try / catch

err := model.RenameBookmark(old, name)
if err != nil && strings.Contains(err.Error(), invalidCharHint) {
    // show localized message Conf.Language(112) and re-prompt
}

Prevention

When it happens

Trigger: Calling RenameBookmark (via renameBookmark API handler or bookmarkRename menu action) with newBookmark containing characters like [ ] ( ) ** ` # or other marker characters detected by treenode.ContainsMarker.

Common situations: User pastes a heading or link-like string into the bookmark rename dialog; plugin/automation renames bookmarks using titles that contain markup; batch rename scripts that do not sanitize names.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


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