siyuan-note/siyuan · error

new item template [%s] not found

Error message

new item template [%s] not found

What it means

Error "new item template [%s] not found" thrown in siyuan-note/siyuan.

Source

Thrown at kernel/model/attribute_view_new_item.go:80

type CreateAttributeViewItemDocsResult struct {
	ItemIDs        []string     `json:"itemIDs"`
	BlockIDs       []string     `json:"blockIDs"`
	SkippedItemIDs []string     `json:"skippedItemIDs,omitempty"`
	Warnings       []string     `json:"warnings,omitempty"`
	Transaction    *Transaction `json:"-"`
}

// CreateAttributeViewItem 按指定模板创建一个数据库条目。templateID 为空时创建空白游离条目。
func CreateAttributeViewItem(avID, blockID, viewID, templateID, previousID, groupID string) (*CreateAttributeViewItemResult, error) {
	attrView, err := av.ParseAttributeView(avID)
	if nil != err {
		return nil, err
	}
	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]
	}
	preview, err := resolveAttributeViewNewItemTemplate(blockID, itemTemplate, createdAt)
	if nil != err {
		return nil, err
	}
	for _, prunedOption := range prunedOptions {
		if templateID == prunedOption.TemplateID {

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Verify the new item template ID exists in the attribute view's newItemTemplates config before using it.
  2. List available templates via the attribute view config and pick a valid template ID.

Example fix

Open the database's new-item template settings, copy the template id from the existing entries, and pass that id to the create-item call.

When it happens

Trigger: Creating an attribute view item from a template whose ID has been deleted or was mistyped.

Common situations: Occurs when creating an attribute view row with a new-item template ID that no longer exists, for example after the template was deleted in another view or device.


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