siyuan-note/siyuan · error

Do not include Markdown syntax marker [%s]

Error message

Do not include Markdown syntax marker [%s]

What it means

In RenameBookmark (bookmark.go:96) the very first check runs treenode.ContainsMarker(newBookmark); if it returns a non-empty char, the function returns fmt.Errorf(Conf.Language(112), invalidChar) — 'Do not include Markdown syntax marker [%s]'. Bookmark names are stored in block IAL and feed the bookmark panel, so characters that double as Markdown/Kramdown syntax markers (#, *, >, -, +, =, ~, `, etc.) are forbidden to avoid ambiguous/parsable names.

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 251596fc0d)

Solutions

  1. Strip or replace Markdown marker characters from the new bookmark name before submitting.
  2. Validate client-side by replicating treenode.ContainsMarker's character set.
  3. Prefer plain alphanumeric + space/CJK names for bookmarks.

Example fix

// before
model.RenameBookmark(old, '#inbox-2024')

// after: remove leading markers and inline Markdown syntax chars
name := strings.TrimLeft(newBookmark, "#*>-=+~` ")
model.RenameBookmark(old, name)
Defensive patterns

Strategy: validation

Validate before calling

// Strip Markdown marker characters before renaming a bookmark.
if c := treenode.ContainsMarker(newBookmark); c != "" {
    newBookmark = strings.Map(func(r rune) rune {
        if treenode.ContainsMarker(string(r)) != "" { return -1 }
        return r
    }, newBookmark)
}

Try / catch

// HTTP caller: surface the offending marker so the user can fix the name.
if (r.code === -1 && /Markdown syntax marker/i.test(r.msg)) {
    showFieldError('newBookmark', r.msg) // message includes the [%s] char
}

Prevention

When it happens

Trigger: POST /api/bookmark/renameBookmark {oldBookmark, newBookmark} (or MCP bookmark tool / CLI bookmark command) with a newBookmark containing a Markdown marker character such as '#inbox', '*important', '>note', or '-todo'.

Common situations: User pasting a Markdown-flavored label; tooling that prefixes labels with # (a common 'tag' convention) — which collides with the heading marker.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/61e6dda3e4ed36a2. Report an issue: GitHub.