siyuan-note/siyuan · error
attribute view rich text style entity sentinel was not…
Error message
attribute view rich text style entity sentinel was not removed from node [%s]
What it means
Final safety pass: after restoration, a second AST walk found a node whose fields (tokens, text mark fields, IAL attributes, properties, IDs) still contain the sentinel string. Some sentinel survived the replacement replacers, meaning restoration did not fully rewrite the tree, so the library rejects the content rather than leaking private-use sentinel characters into stored rich text.
Solutions
- Locate the sentinel in the offending node type and remove it manually or regenerate that portion of the content
- Ensure the content never embeds private-use sentinel characters in IDs, IAL attributes, or mark metadata fields
- Run the content through a full editor round-trip (DOM -> Kramdown) which rebuilds all fields from scratch
- Restore the value from a known-good history entry
Example fix
// before: sentinel in IAL
{: id="..." style="x \ue000siyuan-av-rich-text-style-entities-0\ue002 y"}
// after
{: style="color: var(--b3-font-color1);"} Defensive patterns
Strategy: validation
Validate before calling
// reject sentinels anywhere outside restored mark/token fields
const sentinel = "\ue000siyuan-av-rich-text-style-entities";
if (blockId.includes(sentinel) || JSON.stringify(ial).includes(sentinel)) {
throw new Error("sentinel leaked into ID or IAL attribute");
} Try / catch
try { save(value) } catch (e) { if (String(e).includes("sentinel was not removed")) { value = regenerateViaRoundTrip(value); retry(); } } Prevention
- Never inject sentinel strings into IDs, IAL attributes, or mark metadata
- Assemble rich text only through the official normalization pipeline
- Treat U+E000-U+E002 characters as reserved and strip them from user input
When it happens
Trigger: Calling NormalizeValueTextRich / NormalizeRichContent on content where a sentinel appears in a node field the replacers do not rewrite, e.g. inside node.ID, TextMarkBlockRefID, an IAL attribute other than 'style', node properties, or a doubly-nested token that the replacer did not cover.
Common situations: Hand-crafted Kramdown with sentinels injected into block IDs or IAL attributes; content assembled by concatenating fragments from two different sanitization passes; adversarial/tampered payloads.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- attribute view rich text style entity was not restored
- invalid encoded style entity in attribute view rich text…
- invalid encoded style entity in attribute view rich text…
- attribute view rich text normalization did not converge
- attribute view rich text tree is missing
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/ef4f1686f6eae863.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/av/value.go:2014
}
node.Tokens = []byte(literalReplacer.Replace(tokens))
default:
err = fmt.Errorf("invalid encoded style entity in attribute view rich text node [%s]", node.Type.String())
return ast.WalkStop
}
return ast.WalkContinue
})
if nil != err {
return
}
for _, found := range restored {
if !found {
return fmt.Errorf("attribute view rich text style entity was not restored")
}
}
ast.Walk(tree.Root, func(node *ast.Node, entering bool) ast.WalkStatus {
if entering && valueTextRichNodeContainsSentinel(node, sentinel) {
err = fmt.Errorf("attribute view rich text style entity sentinel was not removed from node [%s]",
node.Type.String())
return ast.WalkStop
}
return ast.WalkContinue
})
return
}
func valueTextRichNodeContainsSentinel(node *ast.Node, sentinel string) bool {
values := []string{
node.ID, node.Spec, node.Data, string(node.Tokens), string(node.CodeBlockOpenFence),
string(node.CodeBlockInfo), string(node.CodeBlockCloseFence), string(node.LinkRefLabel),
string(node.FootnotesRefLabel), node.FootnotesRefId, string(node.HtmlEntityTokens),
node.TextMarkType, node.TextMarkAHref, node.TextMarkATitle, node.TextMarkInlineMathContent,
node.TextMarkInlineMemoContent, node.TextMarkBlockRefID, node.TextMarkBlockRefSubtype,
node.TextMarkFileAnnotationRefID, node.TextMarkFlashcardOcclusionID, node.TextMarkTextContent,
}
for _, value := range values {View on GitHub (pinned to 9f775e8a12)