{"record":{"id":"4cd91d7aa327967e","repo":"siyuan-note/siyuan","slug":"encrypted-notebook-attribute-view-snapshot-is-plai","errorCode":null,"errorMessage":"encrypted notebook attribute view snapshot is plaintext [%s]","messagePattern":"encrypted notebook attribute view snapshot is plaintext \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/attribute_view_render.go","lineNumber":1273,"sourceCode":"\treturn\n}\n\nfunc decryptHistoricalAttributeView(boxID, avID string, data []byte) ([]byte, error) {\n\tciphertext := util.IsCiphertext(data)\n\tif boxID == \"\" {\n\t\tif ciphertext {\n\t\t\treturn nil, errors.New(\"encrypted attribute view snapshot is missing notebook context\")\n\t\t}\n\t\treturn data, nil\n\t}\n\tif !IsEncryptedBox(boxID) {\n\t\tif ciphertext {\n\t\t\treturn nil, fmt.Errorf(\"encrypted attribute view snapshot has no matching notebook [%s]\", boxID)\n\t\t}\n\t\treturn data, nil\n\t}\n\tif !ciphertext {\n\t\treturn nil, fmt.Errorf(\"encrypted notebook attribute view snapshot is plaintext [%s]\", boxID)\n\t}\n\treturn av.DecryptAVData(boxID, avID, data)\n}\n","sourceCodeStart":1255,"sourceCodeEnd":1277,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/attribute_view_render.go#L1255-L1277","documentation":"Thrown by decryptHistoricalAttributeView when the inferred boxID refers to an encrypted notebook (IsEncryptedBox true) but the AV file content is plaintext (IsCiphertext false). For an encrypted notebook, stored AV objects are expected to be ciphertext, so plaintext signals an inconsistent state.","triggerScenarios":"A notebook is marked encrypted, yet its storage/av/<avID>.json file is plaintext. Happens when the AV was written before encryption was enabled and never re-encrypted, or when a partial migration left some objects unencrypted.","commonSituations":"Enabling notebook encryption on a notebook that already had plaintext AV files, followed by an incomplete encryption pass; or restoring an old plaintext object into an encrypted notebook from history.","solutions":["Re-trigger encryption of the notebook's stored objects so the AV file is encrypted consistently.","If encryption was enabled in error, either disable it for the notebook or accept that the plaintext file must be migrated.","Restore from a backup that matches the notebook's current encryption state."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"data, err := decryptHistoricalAttributeView(boxID, avID, data)\nif err != nil {\n    if strings.Contains(err.Error(), \"is plaintext\") {\n        // encrypted notebook holds a plaintext AV; re-encrypt or migrate\n    }\n    return err\n}","preventionTips":["After enabling notebook encryption, ensure all pre-existing AV files are re-encrypted.","Do not restore old plaintext objects into an encrypted notebook without migrating them.","Run the notebook encryption pass to completion and verify object states."],"tags":["attribute-view","encryption","data-integrity","notebook-context"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}