{"record":{"id":"4507dbb1a30af6d8","repo":"siyuan-note/siyuan","slug":"conf-language-313-localized-message-bookmark-ta","errorCode":null,"errorMessage":"Conf.Language(313) (localized message: bookmark/tag not supported in encrypted notebooks)","messagePattern":"Conf\\.Language\\(313\\) \\(localized message: bookmark/tag not supported in encrypted notebooks\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/blockial.go","lineNumber":370,"sourceCode":"\tif oldAttrs[DocSortModeAttr] != newAttrs[DocSortModeAttr] && ast.NodeDocument == node.Type {\n\t\tcache.RemoveDocIALInBox(tree.Path, tree.Box)\n\t\tcache.PutDocIALInBox(tree.Path, tree.Box, newAttrs)\n\t}\n\tpushBlockAttrs(oldAttrs, node)\n\tpushDocSortModeChanged(oldAttrs, node, tree)\n\treturn\n}\n\nfunc setNodeAttrs0(node *ast.Node, nameValues map[string]string, boxID string) (oldAttrs map[string]string, err error) {\n\tif err = treenode.ValidateTabsAttrs(node, nameValues); nil != err {\n\t\treturn\n\t}\n\t// 加密笔记本不支持书签和标签（依赖全局 SQLite 聚合，加密笔记本是孤岛）\n\tif IsEncryptedBox(boxID) && boxID != \"\" {\n\t\tfor name := range nameValues {\n\t\t\tswitch strings.ToLower(name) {\n\t\t\tcase \"bookmark\", \"tags\":\n\t\t\t\terr = errors.New(Conf.Language(313))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\toldAttrs = parse.IAL2Map(node.KramdownIAL)\n\tnewAttrsUnEsc := parse.IAL2MapUnEsc(node.KramdownIAL)\n\tfor name := range nameValues {\n\t\tif \"fold\" == strings.ToLower(name) {\n\t\t\tdelete(newAttrsUnEsc, \"heading-fold\")\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor name, value := range nameValues {\n\t\tvalue = util.RemoveInvalidRetainCtrl(value)\n\t\tvalue = strings.TrimSpace(value)\n\t\tlowerName := strings.ToLower(name)\n\t\t// 转换为小写再验证属性名","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/blockial.go#L352-L388","documentation":"Encrypted notebooks are isolated from the global SQLite aggregation layer, so bookmark and tags attributes — which rely on that aggregation — are rejected in setNodeAttrs0. When any attribute name in the update is \"bookmark\" or \"tags\" (case-insensitive) on an encrypted box, the localized message at key 313 is returned and no attributes are written.","triggerScenarios":"Setting or updating the \"bookmark\" or \"tags\" attribute (any letter case) on a block inside a notebook created as encrypted (IsEncryptedBox true), via setNodeAttrs, BatchSetBlockAttrs, or any of the AV-binding paths that funnel into setNodeAttrs0.","commonSituations":"Users of encrypted notebooks trying to use the bookmark/tag panel; plugins that generically sync bookmark/tags across all notebooks; migration scripts assuming all notebooks support tags.","solutions":["Move the block to a non-encrypted notebook if bookmark/tags are required","Use custom-* attributes instead of bookmark/tags in encrypted notebooks","Drop the bookmark/tags keys from the attribute payload for encrypted boxes"],"exampleFix":"// before\nsetNodeAttrs(boxID, id, map[string]string{\"tags\": \"a b\"}) // error: Language(313) on encrypted box\n// after\nif IsEncryptedBox(boxID) {\n    setNodeAttrs(boxID, id, map[string]string{\"custom-tags\": \"a b\"})\n} else {\n    setNodeAttrs(boxID, id, map[string]string{\"tags\": \"a b\"})\n}","handlingStrategy":"validation","validationCode":"// TS: filter bookmark/tags for encrypted notebooks\nconst isEncrypted = window.siyuan.notebooks[notebookId]?.encrypted;\nconst attrs = isEncrypted\n  ? Object.fromEntries(Object.entries(rawAttrs).filter(([k]) => !/^(bookmark|tags)$/i.test(k)))\n  : rawAttrs;","typeGuard":"function safeAttrsForBox(notebookId: string, attrs: Record<string,string>): Record<string,string> {\n  if (!isEncryptedBox(notebookId)) return attrs;\n  const out: Record<string,string> = {};\n  for (const [k, v] of Object.entries(attrs)) {\n    if (!/^(bookmark|tags)$/i.test(k)) out[k] = v;\n  }\n  return out;\n}","tryCatchPattern":null,"preventionTips":["Check notebook encryption status before using bookmark/tag features","Use custom-* attributes for tagging in encrypted notebooks","Hide bookmark/tag UI when the active notebook is encrypted"],"tags":["encrypted-notebook","bookmark","tags","unsupported-feature"],"backgroundTag":"unsupported-operation","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}