{"record":{"id":"a2251524a6e342b0","repo":"siyuan-note/siyuan","slug":"s-w-conf-language-376-wrapping-underlying-err","errorCode":null,"errorMessage":"%s: %w (Conf.Language(376) wrapping underlying error)","messagePattern":"(.+?): %w \\(Conf\\.Language\\(376\\) wrapping underlying error\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/asset_download.go","lineNumber":161,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, file := range files {\n\t\tif file.Path == rel {\n\t\t\tif repoFileNeedsDownload(file) {\n\t\t\t\tif err = checkAssetDownloadAccess(); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\trepo, repoErr := newSyncRepositoryWithAssetSourceLocked()\n\t\t\tif repoErr != nil {\n\t\t\t\treturn repoErr\n\t\t\t}\n\t\t\tvar downloaded bool\n\t\t\thandleCloudError := cloudRepoErrorHandler()\n\t\t\tif downloaded, err = repo.EnsureAsset(rel, newSyncContext()); err != nil {\n\t\t\t\thandleCloudError(err)\n\t\t\t\treturn fmt.Errorf(\"%s: %w\", Conf.Language(376), err)\n\t\t\t}\n\t\t\tif downloaded {\n\t\t\t\tHandleAssetsChangeEvent(absPath)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn &os.PathError{Op: \"open\", Path: absPath, Err: os.ErrNotExist}\n}\n\n// EnsureAssetPrefixLocal 补齐逻辑清单中的目录内容，不能仅遍历本地磁盘。\nfunc EnsureAssetPrefixLocal(absPrefix string) error {\n\tprefix, err := dataRelativeAssetPath(absPrefix)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfiles, err := deferredSyncAssets()\n\tif err != nil || len(files) == 0 {","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/asset_download.go#L143-L179","documentation":"EnsureAssetLocal failed to download a required asset from the cloud repository (repo.EnsureAsset error). SiYuan wraps the underlying sync error with the localized subscription/cloud message (i18n 376) so the caller sees a user-facing message plus the root cause via %w.","triggerScenarios":"EnsureAssetLocal (directly or via ocr, copyDecryptedAsset, getFile, GetAssetAbsPath, GetExportFilePath, ensureReadableAssetLocal) requests an asset missing locally while cloud download fails — network outage, missing cloud object, auth failure, or no subscription.","commonSituations":"Offline editing references an asset never synced; cloud object deleted or retention expired; wrong sync credentials; interrupted prior download leaving the asset absent.","solutions":["Inspect the wrapped error (%w) for the root cause — network, auth, or missing object","Restore network connectivity / fix sync credentials and retry","Re-upload the asset from another device that has it, or re-sync the workspace","Disable asset download mode and rely on locally present assets"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := model.EnsureAssetLocal(absPath); err != nil {\n  var root error = errors.Unwrap(err) // %w-wrapped cause\n  log.Println(\"asset download failed:\", root)\n  // retry after connectivity/auth fix, or fall back to local-only assets\n}","preventionTips":["Check network/auth before triggering cloud downloads","Use errors.Unwrap / errors.As to distinguish auth vs network causes","Provide a local-only fallback when the asset already exists offline"],"tags":["cloud","sync","download","wrapped-error"],"backgroundTag":"network-request-failed","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"}