{"record":{"id":"b925e81c3ecc1832","repo":"siyuan-note/siyuan","slug":"encrypted-assets-are-not-supported","errorCode":null,"errorMessage":"encrypted assets are not supported","messagePattern":"encrypted assets are not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/asset_relink.go","lineNumber":266,"sourceCode":"\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tif !info.Mode().IsRegular() {\n\t\t\treturn \"\", fmt.Errorf(\"asset must be a regular file: %s\", assetPath)\n\t\t}\n\t\treal, err := filepath.EvalSymlinks(candidate)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\trealRoot, err := filepath.EvalSymlinks(root)\n\t\tif err != nil || !gulu.File.IsSubPath(realRoot, real) {\n\t\t\treturn \"\", fmt.Errorf(\"asset escapes its directory: %s\", assetPath)\n\t\t}\n\t\tif err = validateRelinkStoragePath(real); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tif IsEncryptedAssetPath(real) {\n\t\t\treturn \"\", errors.New(\"encrypted assets are not supported\")\n\t\t}\n\t\tif found != \"\" && found != candidate {\n\t\t\treturn \"\", fmt.Errorf(\"ambiguous asset path: %s\", assetPath)\n\t\t}\n\t\tfound = candidate\n\t}\n\tif required && found == \"\" {\n\t\treturn \"\", fmt.Errorf(\"target asset does not exist locally: %s\", assetPath)\n\t}\n\treturn found, nil\n}\n\nfunc (p *assetRelinkPlan) scanViews() error {\n\tdir := filepath.Join(util.DataDir, \"storage\", \"av\")\n\tif err := p.observe(dir); err != nil {\n\t\treturn err\n\t}\n\tentries, err := os.ReadDir(dir)","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/asset_relink.go#L248-L284","documentation":"The relink engine does not support encrypted assets. After path resolution and escape checks, resolveRelinkAsset calls IsEncryptedAssetPath(real) on the resolved path and rejects it if the asset is in an encrypted-asset envelope. Encryption of assets is out of scope for reference relinking.","triggerScenarios":"Relinking an asset whose resolved real path is recognized by IsEncryptedAssetPath — i.e. the file is stored in the encrypted-asset format; triggered via RelinkAsset/FindAssetReferences mappings from scanMetadata; also referenced by the related query/fragment rejection in newAssetRelinker.","commonSituations":"Users of encrypted notebooks attempting to rename encrypted assets through the relink API; automated scripts iterating an assets directory that includes encrypted-envelope files; confusing ordinary assets with encrypted ones after enabling encryption features.","solutions":["Relink only ordinary (non-encrypted) assets; manage encrypted assets through the encrypted-notebook workflows instead.","Exclude encrypted asset files (detect with IsEncryptedAssetPath) from bulk relink mappings before calling the API.","If the asset must be renamed, decrypt or re-create it through the supported app flow, then relink the plain copy if applicable.","Run dryRun=true to identify which mapping is encrypted before the real operation."],"exampleFix":"// before\nfor _, m := range mappings {\n    RelinkAsset(m.OldPath, m.NewPath, false) // may hit encrypted asset\n}\n// after\nfor _, m := range mappings {\n    if model.IsEncryptedAssetPath(m.OldPath) {\n        continue\n    }\n    RelinkAsset(m.OldPath, m.NewPath, false)\n}","handlingStrategy":"validation","validationCode":"if model.IsEncryptedAssetPath(realPath) {\n    return errors.New(\"skip encrypted asset\")\n}","typeGuard":"func isRelinkableAsset(p string) bool {\n    return !model.IsEncryptedAssetPath(p)\n}","tryCatchPattern":"if err != nil && err.Error() == \"encrypted assets are not supported\" {\n    // route the asset to the encrypted-notebook workflow instead\n}","preventionTips":["Filter mappings with IsEncryptedAssetPath before relinking","Handle encrypted assets only through encrypted-notebook features","Document to users that relink supports plain assets only"],"tags":["encryption","asset-relink","unsupported"],"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"}