siyuan-note/siyuan · error
unsupported block data type
Error message
unsupported block data type [%s]
What it means
parseBlockUpdateData only accepts dataType "markdown" or "dom" for block update payloads. Any other dataType value hits the default branch and returns this error naming the unsupported type. It is an input-validation guard on the block update API.
Solutions
- Set dataType to exactly "markdown" when sending Markdown content
- Set dataType to exactly "dom" when sending pre-rendered block DOM
- Check the API request body for typos in the dataType field
Example fix
// before
{"dataType": "md", "data": "# heading"}
// after
{"dataType": "markdown", "data": "# heading"} Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED = ["markdown", "dom"];
if (!ALLOWED.includes(payload.dataType)) throw new Error(`dataType must be one of ${ALLOWED}`); Type guard
const isBlockDataType = (t) => t === "markdown" || t === "dom";
Prevention
- Use constants for dataType values instead of raw strings
- Check the current API docs for accepted dataType values
- Add client-side enum validation before sending requests
When it happens
Trigger: Calling buildBlockUpdateOperations (via /api/block/updateBlock) with a dataType other than "markdown" or "dom" — e.g. "md", "text", "html", or an empty string.
Common situations: Typos in API integrations; clients reusing dataType values from other SiYuan endpoints (such as "markdown" vs "dom" confusion); copy-pasted code from older API examples using different type names.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- block [ ] type is locked: expected , got
- AI editor action must not be empty
- block swap requires two non-document blocks
- Bookmark cannot be empty
- can not remove [ ] caused by it is a reserved file
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/555bee0ac3fd31a2.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/block_update.go:214
}
if "" != invalidID {
return "", errors.New("found invalid ID [" + invalidID + "]")
}
return
}
func parseBlockUpdateData(data, dataType string, luteEngine *lute.Lute) (ret string, tree *parse.Tree, err error) {
ret = data
switch dataType {
case "markdown":
ret, err = DataBlockDOM(data, luteEngine)
if err != nil {
err = fmt.Errorf("data block DOM failed: %w", err)
return
}
case "dom":
default:
err = fmt.Errorf("unsupported block data type [%s]", dataType)
return
}
tree = luteEngine.BlockDOM2Tree(ret)
if nil == tree || nil == tree.Root || nil == firstContentBlock(tree.Root) {
err = errors.New("parse tree failed")
}
return
}
func normalizeBlockUpdateTree(oldNode *ast.Node, tree *parse.Tree, luteEngine *lute.Lute) (ret *parse.Tree, updatedNode *ast.Node, err error) {
updatedNode, err = resolveBlockUpdateNode(oldNode, tree.Root)
if err != nil {
return nil, nil, err
}
updatedNode.Unlink()
root := &ast.Node{Type: ast.NodeDocument}View on GitHub (pinned to 9f775e8a12)