{"record":{"id":"bdf3f675330a1545","repo":"siyuan-note/siyuan","slug":"encrypted-notebook-metadata-is-missing","errorCode":null,"errorMessage":"encrypted notebook metadata is missing","messagePattern":"encrypted notebook metadata is missing","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/box_conf_crypto.go","lineNumber":56,"sourceCode":"\t}\n\tmetadata := &encryptedBoxMetadata{\n\t\tIcon:     filterBoxIcon(boxConf.Icon),\n\t\tSort:     boxConf.Sort,\n\t\tSortMode: boxConf.SortMode,\n\t}\n\tplaintext, err := gulu.JSON.MarshalJSON(metadata)\n\tif err != nil {\n\t\treturn err\n\t}\n\tkey := util.DeriveSubKey(dek, \"siyuan/box-metadata\")\n\tdefer zeroAndClear(key)\n\tboxConf.BoxCrypt.Metadata, err = util.EncryptWithAAD(key, plaintext, boxMetadataAAD(boxID))\n\treturn err\n}\n\nfunc decryptBoxMetadata(boxID string, boxConf *conf.BoxConf, dek []byte) error {\n\tif boxConf == nil || boxConf.BoxCrypt == nil || len(boxConf.BoxCrypt.Metadata) == 0 {\n\t\treturn errors.New(\"encrypted notebook metadata is missing\")\n\t}\n\tkey := util.DeriveSubKey(dek, \"siyuan/box-metadata\")\n\tdefer zeroAndClear(key)\n\tplaintext, err := util.DecryptWithAAD(key, boxConf.BoxCrypt.Metadata, boxMetadataAAD(boxID))\n\tif err != nil {\n\t\treturn err\n\t}\n\tmetadata := &encryptedBoxMetadata{}\n\tif err = gulu.JSON.UnmarshalJSON(plaintext, metadata); err != nil {\n\t\treturn err\n\t}\n\tboxConf.Icon = filterBoxIcon(metadata.Icon)\n\tboxConf.Sort = metadata.Sort\n\tboxConf.SortMode = metadata.SortMode\n\treturn nil\n}\n\nfunc revealBoxMetadataIfUnlocked(boxID string, boxConf *conf.BoxConf) error {","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/box_conf_crypto.go#L38-L74","documentation":"decryptBoxMetadata guard in the encrypted-notebook code: the notebook conf's BoxCrypt.Metadata ciphertext is absent or empty, so there is nothing to decrypt for the encrypted metadata (icon/sort/sortMode). Indicates a corrupted or incomplete encryption envelope on the notebook configuration.","triggerScenarios":"Thrown at kernel/model/box_conf_crypto.go:56 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Restore the notebook configuration from the encrypted notebook backup","Verify BoxCrypt fields are intact after sync/upgrade; repair from recovery material if not","Do not delete the notebook; use the documented recovery flow to preserve existing encrypted data"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}