siyuan-note/siyuan · error

Do not include Markdown syntax marker

Error message

Do not include Markdown syntax marker [%s]

What it means

model.RenameBookmark (POST /api/bookmark/renameBookmark) validates the new name with treenode.ContainsMarker (kernel/treenode/marker.go:24), which rejects ASCII Markdown/LaTeX marker characters: * _ [ ] \ ! ` < > & ~ $ { } ( ) = # ^. The offending character is returned in the message. Non-ASCII names (e.g. Chinese) always pass because the check applies only to ASCII strings.

Solutions

  1. Strip or replace the marker character reported in the [%s] placeholder
  2. Sanitize bookmark names up front: remove * _ [ ] \ ! ` < > & ~ $ { } ( ) = # ^ from ASCII input
  3. Use full-width variants or plain words (e.g. 'C♯ notes' or 'C sharp notes') if the symbol matters visually

Example fix

// before
renameBookmark('old', 'C# / [draft]'); // error: marker [#]

// after
renameBookmark('old', 'C sharp draft');
Defensive patterns

Strategy: validation

Validate before calling

const MARKERS = /[*_\[\]\\!`<>&~${}()=#^]/;
if (MARKERS.test(newBookmark)) throw new Error('bookmark name contains a Markdown marker');

Prevention

When it happens

Trigger: renameBookmark with newBookmark such as 'C# notes' (#), 'v2 *draft*' (*), '[inbox]' (brackets), or 'a & b' (&). The marker check runs before the empty-name check.

Common situations: Automated bookmark import/merge tools that build names from folder names or tags containing '#', '*', or brackets; using Markdown-ish labels as bookmark names.

Related errors


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

Appendix: 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 afa823b6b4)