siyuan-note/siyuan · error
new item template [ ] does not create a bound block
Error message
new item template [%s] does not create a bound block
What it means
createAttributeViewItem validates that a template used with a Markdown document payload targets documents. When CreateAttributeViewItemWithMarkdown (or the internal createAttributeViewItem) is called with a non-nil `document`, but the resolved new-item template's TargetType is not av.NewItemTargetDocument, the API cannot attach the supplied Markdown to a bound block and fails fast with this error. It is a caller-side template/payload mismatch guard, not a data corruption error.
Solutions
- Open the database's new-item template settings and change the referenced template's target type to 'document' (NewItemTargetDocument), or pick a template ID that already targets documents
- If a bound block is not needed, call CreateAttributeViewItem instead of CreateAttributeViewItemWithMarkdown and pass no document payload
- Before calling, resolve the template (attrView.GetNewItemTemplate(templateID)) and assert TargetType == av.NewItemTargetDocument
Example fix
// before
result, err := model.CreateAttributeViewItemWithMarkdown(avID, blockID, viewID, detachedTemplateID, "", "", doc)
// after
if tpl := attrView.GetNewItemTemplate(detachedTemplateID); tpl != nil && tpl.TargetType != av.NewItemTargetDocument {
result, err = model.CreateAttributeViewItem(avID, blockID, viewID, detachedTemplateID, "", "")
} else {
result, err = model.CreateAttributeViewItemWithMarkdown(avID, blockID, viewID, detachedTemplateID, "", "", doc)
} Defensive patterns
Strategy: validation
Validate before calling
if tpl := attrView.GetNewItemTemplate(templateID); doc != nil && tpl != nil && tpl.TargetType != av.NewItemTargetDocument {
return fmt.Errorf("template %s cannot accept a document payload", templateID)
} Prevention
- Always resolve the template and check TargetType before sending a Markdown document payload
- Keep template IDs in client config synchronized with the database's template definitions
- Use CreateAttributeViewItem (no document) for detached templates
When it happens
Trigger: Call CreateAttributeViewItemWithMarkdown (kernel API /api/attr/createAttributeViewItemWithMarkdown) with a document payload while the templateID resolves to a template whose TargetType is NewItemTargetDetached (or any non-document target). Also occurs when the stored template in the attribute view was edited/changed to a non-document target after the client decided to send Markdown.
Common situations: A plugin or client cached a template ID that was later reconfigured in the database's 'new item template' settings to a detached item; UI code that always sends Markdown for every template; version drift where older templates created before the document-target feature default to detached.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- bind attribute view item
- clone attribute view item failed
- clone attribute view item
- invalid create attribute view item documents save mode
- new attribute view item document in an encrypted notebook…
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/1eec4a644b5ef160.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/attribute_view_new_item.go:118
createdAt := time.Now()
itemTemplate := attrView.GetNewItemTemplate(templateID)
var prunedOptions []*av.PrunedNewItemTemplateOption
if "" != templateID && nil == itemTemplate {
return nil, fmt.Errorf("new item template [%s] not found", templateID)
}
if nil == itemTemplate {
itemTemplate = &av.NewItemTemplate{TargetType: av.NewItemTargetDetached}
} else {
cloned := *attrView
prunedOptions = cloned.PruneInvalidNewItemTemplateFieldValues()
if err = cloned.SetNewItemTemplates(&av.NewItemTemplatesConfig{Templates: []*av.NewItemTemplate{itemTemplate}}); nil != err {
return nil, err
}
attrView = &cloned
itemTemplate = cloned.NewItemTemplates[0]
}
if nil != document && av.NewItemTargetDocument != itemTemplate.TargetType {
return nil, fmt.Errorf("new item template [%s] does not create a bound block", templateID)
}
primaryFallback := ""
if nil != document {
primaryFallback = document.Title
}
preview, err := resolveAttributeViewNewItemTemplateWithFallback(blockID, itemTemplate, createdAt, primaryFallback)
if nil != err {
return nil, err
}
for _, prunedOption := range prunedOptions {
if templateID == prunedOption.TemplateID {
preview.Warnings = append(preview.Warnings, fmt.Sprintf(Conf.Language(353),
prunedOption.KeyID, strings.Join(prunedOption.Values, ", ")))
}
}
dbTree, err := LoadTreeByBlockID(blockID)
if nil != err {View on GitHub (pinned to 9f775e8a12)