siyuan-note/siyuan · error

Conf.Language(112) {invalidChar}

Error message

Conf.Language(112) {invalidChar}

What it means

RenameTag calls treenode.ContainsMarker(newLabel); if the new label contains any Markdown block/inline marker character (e.g. #, *, -, >, [, ], `, etc.) it returns fmt.Errorf(Conf.Language(112), invalidChar) = 'Do not include Markdown syntax marker [<char>]'. Tags are stored as text, so marker characters would corrupt parsing or be interpreted as syntax.

Source

Thrown at kernel/model/tag.go:128

	indexHistoryDir(filepath.Base(historyDir), util.NewLute())
	sql.FlushQueue()

	reloadTreeIDs = gulu.Str.RemoveDuplicatedElem(reloadTreeIDs)
	for _, id := range reloadTreeIDs {
		ReloadProtyle(id)
	}

	updateAttributeViewBlockText(updateNodes)

	sql.FlushQueue()
	util.PushClearProgress()
	return
}

func RenameTag(oldLabel, newLabel string) (err error) {
	if invalidChar := treenode.ContainsMarker(newLabel); "" != invalidChar {
		return fmt.Errorf(Conf.Language(112), invalidChar)
	}

	newLabel = strings.TrimPrefix(newLabel, "/")
	newLabel = strings.TrimSuffix(newLabel, "/")
	newLabel = strings.TrimSpace(newLabel)

	if "" == newLabel {
		return errors.New(Conf.Language(114))
	}

	if oldLabel == newLabel {
		return
	}

	util.PushEndlessProgress(Conf.Language(110))
	util.RandomSleep(500, 1000)

	tags := sql.QueryTagSpansByLabel(oldLabel)

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Remove Markdown marker characters from the new tag label.
  2. Drop a leading '#' (tags do not need it); use plain words.
  3. If you need grouping, use '/' path separators (allowed) instead of marker chars.

Example fix

// before: newLabel="work #1" -> error 112 with invalidChar='#'
// after: newLabel="work-1"
Defensive patterns

Strategy: validation

Validate before calling

// Go caller
if c := treenode.ContainsMarker(newLabel); c != "" {
    return fmt.Errorf("tag label must not contain markdown marker %q", c)
}

Type guard

// Go
func tagLabelIsSafe(label string) bool { return treenode.ContainsMarker(label) == "" }

Prevention

When it happens

Trigger: POST /api/tag/renameTag (or the MCP tag tool, or CLI `siyuan tag rename`) with a newLabel containing a Markdown marker character. Examples: 'work #1', 'a*b', '-task', '`code`'.

Common situations: User prefixes the tag with '#' thinking it denotes a tag. Tag name contains emphasis or list syntax. Importing tags from another tool that allowed '#'.

Related errors


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