siyuan-note/siyuan · error
new attribute view item document in an encrypted notebook…
Error message
new attribute view item document in an encrypted notebook must be saved in the current notebook
What it means
validateNewItemSaveBox enforces that when the database block lives in an encrypted notebook, any document created from a new-item template must be saved in that same notebook. If the template's save-location configuration resolves to a different notebook (targetBoxID), creation is refused. This protects encrypted-notebook invariants: content must never be written outside the encrypted box.
Solutions
- Edit the template's save location so the target notebook equals the notebook containing the database (the current box)
- Clear the template's custom save-location override so documents inherit the current notebook
- If cross-notebook saving is required, move the database (and its block) out of the encrypted notebook first
Defensive patterns
Strategy: validation
Validate before calling
if model.IsEncryptedBox(currentBoxID) && tpl.SaveLocation != nil && tpl.SaveLocation.BoxID != "" && tpl.SaveLocation.BoxID != currentBoxID {
return errors.New("template save location targets another notebook")
} Prevention
- Keep document-template save locations pointing at the database's own notebook when the notebook is encrypted
- Re-check templates after converting a notebook to encrypted
- Avoid sharing templates with hard-coded target notebooks into encrypted notebooks
When it happens
Trigger: Creating an attribute-view item document in an encrypted notebook whose template SaveLocation (custom notebook/path) points to a different notebook, via CreateAttributeViewItemDocs or createAttributeViewItem's document path.
Common situations: A shared template configured with SaveLocation targeting a specific normal notebook, then reused in an encrypted notebook; user later converts a notebook to encrypted while templates still point elsewhere.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- bind attribute view item
- clone attribute view item failed
- clone attribute view item
- conditional replacement of encrypted attribute views is not…
- encrypted attribute view history is missing notebook context
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/d224d66be1adf20a.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/attribute_view_new_item.go:549
}
if nil == Conf.Box(boxID) {
return "", "", false, ErrBoxNotFound
}
if err = validateNewItemSaveBox(currentBoxID, boxID); nil != err {
return "", "", false, err
}
return boxID, location.PathTemplate, false, nil
}
inherited = true
boxID, pathTemplate = ResolveDocCreateSaveLocation(currentBoxID)
err = validateNewItemSaveBox(currentBoxID, boxID)
return
}
func validateNewItemSaveBox(currentBoxID, targetBoxID string) error {
if IsEncryptedBox(currentBoxID) && currentBoxID != targetBoxID {
return errors.New("new attribute view item document in an encrypted notebook must be saved in the current notebook")
}
return nil
}
func newItemParentPathTemplate(renderedPath string) string {
if "" == renderedPath || strings.HasSuffix(renderedPath, "/") {
return renderedPath
}
isAbsolute := strings.HasPrefix(renderedPath, "/")
segments := strings.FieldsFunc(renderedPath, func(r rune) bool { return '/' == r })
if 1 >= len(segments) {
if isAbsolute {
return "/"
}
return ""
}
parent := strings.Join(segments[:len(segments)-1], "/")
if isAbsolute {View on GitHub (pinned to 9f775e8a12)