{"record":{"id":"a315563c5923e738","repo":"siyuan-note/siyuan","slug":"unsupported-encrypted-asset-container-version","errorCode":null,"errorMessage":"unsupported encrypted asset container version","messagePattern":"unsupported encrypted asset container version","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/crypto.go","lineNumber":2344,"sourceCode":"}\n\nfunc parseEncryptedAssetMetadata(data []byte) (*encryptedAssetMetadata, error) {\n\tmetadata := &encryptedAssetMetadata{}\n\tif err := json.Unmarshal(data, metadata); err != nil {\n\t\treturn nil, err\n\t}\n\tvar version struct {\n\t\tSpec        json.RawMessage `json:\"spec\"`\n\t\tContainerID json.RawMessage `json:\"containerID\"`\n\t}\n\tif err := json.Unmarshal(data, &version); err != nil {\n\t\treturn nil, err\n\t}\n\t// 仅认证元数据同时缺少两个版本字段时按旧容器读取，显式空值或不完整的新格式不能降级。\n\tif len(version.Spec) == 0 && len(version.ContainerID) == 0 {\n\t\tmetadata.Spec = encryptedAssetLegacySpec\n\t} else if metadata.Spec != encryptedAssetSpec || len(metadata.ContainerID) != encryptedAssetContainerIDSize {\n\t\treturn nil, errors.New(\"unsupported encrypted asset container version\")\n\t}\n\tif metadata.OriginalName == \"\" || metadata.OriginalName == \".\" ||\n\t\tfilepath.Base(metadata.OriginalName) != metadata.OriginalName || strings.ContainsAny(metadata.OriginalName, `/\\`) {\n\t\treturn nil, errors.New(\"invalid encrypted asset original name\")\n\t}\n\tif metadata.Size < 0 {\n\t\treturn nil, errors.New(\"invalid encrypted asset content metadata\")\n\t}\n\tchunks := uint64(metadata.Size) / encryptedAssetChunkSize\n\tif metadata.Size%encryptedAssetChunkSize != 0 || metadata.Size == 0 {\n\t\tchunks++\n\t}\n\tif metadata.Chunks != chunks {\n\t\treturn nil, errors.New(\"invalid encrypted asset chunk count\")\n\t}\n\treturn metadata, nil\n}\n","sourceCodeStart":2326,"sourceCodeEnd":2362,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/crypto.go#L2326-L2362","documentation":"The decrypted metadata carries format-version fields (Spec and ContainerID). A legacy container (both fields empty) is accepted with the legacy spec; anything else must match the current encryptedAssetSpec and a full-size container ID. This error means the metadata decrypts fine but declares a container version this kernel does not support — typically a newer format written by a newer client, or a half-populated version field.","triggerScenarios":"Opening an encrypted asset written by a future SiYuan version with a different encryptedAssetSpec; metadata where only one of Spec/ContainerID is set (explicit empty or incomplete new format is deliberately not downgraded to legacy); tampered metadata.","commonSituations":"Downgraded kernel reading data produced by an upgraded client; sync propagating containers from a newer client; partial migration that populated one version field but not the other.","solutions":["Upgrade the SiYuan kernel to the version that wrote the asset (check the client version that produced the data)","If the metadata was corrupted/migrated partially, re-encrypt the asset from the original source to regenerate consistent Spec/ContainerID","Verify integrity: a wrong-AAD decryption would fail earlier, so a decrypt-then-version-mismatch usually means a real format delta, not a wrong key"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"plain, name, err := model.DecryptAssetWithName(box, disk, dek, data)\nif err != nil && strings.Contains(err.Error(), \"unsupported encrypted asset container version\") {\n    return fmt.Errorf(\"asset written by a newer SiYuan version; please upgrade the kernel: %w\", err)\n}","preventionTips":["Keep all synced clients on compatible kernel versions before enabling encrypted notebooks","Read release notes for encrypted-asset format changes before downgrading","Re-encrypt assets after any partial migration instead of leaving mixed Spec/ContainerID states"],"tags":["encryption","version-mismatch","compatibility"],"backgroundTag":"unsupported-operation","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}