siyuan-note/siyuan · error
Conf.Language(44), err.Error()
Error message
Conf.Language(44), err.Error()
What it means
This is the user-facing wrapper applied when rootTemplate.ExecuteTemplate fails while executing a child template referenced by node.Define. Conf.Language(44) supplies a localized 'template execution failed' message and the underlying Go text/template runtime error is appended, so the real cause (bad pipeline, missing field, nil pointer in data, function error) is inside the wrapped message.
Solutions
- Read the wrapped inner error after the localized prefix to find the failing action/line
- Check that all fields/functions referenced by the define exist in templateDocTreeDataModel and the funcs map
- Guard possibly-missing data with {{if ...}} or default functions in the template
- Test the define standalone with representative node data to reproduce the runtime error
Example fix
// before: unguarded missing field
.action{.SomeNested.Value}
// after
.action{if .SomeNested}.action{.SomeNested.Value}{end} Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check: ensure referenced fields exist on the data model
typ nodeModel struct{ Title string; Items []string }
// in template use only fields present on templateDocTreeDataModel Try / catch
content, err := rootTemplate.ExecuteTemplate(buf, name, data)
if err != nil {
return fmt.Errorf("template %q execution failed: %w", name, err)
} Prevention
- Guard optional fields with {{if}} before dereferencing them
- Test every define with representative node data before deployment
- Keep template funcs total (never return errors on nil input); nil-check arguments inside funcs
When it happens
Trigger: Executing a validly defined child template with templateDocTreeDataModel(node) as data raises a runtime template error: calling a function with wrong argument types, dereferencing a missing map key/field, a template function returning an error, or wrong number of arguments in an action.
Common situations: Template actions referencing data fields that don't exist on the node data model; custom template funcs (registered in funcs) erroring on nil input; syntax valid at parse time but failing at execution (e.g. index out of range on a slice).
Related errors
- fmt.Errorf(Conf.Language(44), err.Error())
- attribute view [ ] not found in box [ ]
- attribute view [ ] template plan not found
- child template definition
- child template [ ] not found in the current template package
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/21cd9489ff1065d1.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/template_doc_tree_render.go:79
previousAllowCreation := collector.allowCreation
collector.allowCreation = false
defer func() {
collector.allowCreation = previousAllowCreation
}()
buf := &bytes.Buffer{}
buf.Grow(4096)
dataModel := templateDocTreeDataModel(node)
if "" != node.Define {
if nil == rootTemplate.Lookup(node.Define) {
return nil, fmt.Errorf("child template definition [%s] not found", node.Define)
}
if err := validateTemplateCallGraph(rootTemplate, node.Define); nil != err {
return nil, err
}
if err := rootTemplate.ExecuteTemplate(buf, node.Define, dataModel); nil != err {
return nil, fmt.Errorf(Conf.Language(44), err.Error())
}
return buf.Bytes(), nil
}
childPath, err := resolveTemplatePackageFile(collector.templatePath, node.Template)
if nil != err {
return nil, err
}
content, err := os.ReadFile(childPath)
if nil != err {
return nil, err
}
childTemplate := template.New("").Delims(".action{", "}").Funcs(funcs)
childTemplate, err = childTemplate.Parse(string(content))
if nil != err {
return nil, fmt.Errorf(Conf.Language(44), err.Error())
}
if err = validateTemplateCallGraph(childTemplate, childTemplate.Name()); nil != err {View on GitHub (pinned to 8641553a1f)