siyuan-note/siyuan · error
%s: %w (Conf.Language(376) wrapping underlying error)
Error message
%s: %w (Conf.Language(376) wrapping underlying error)
What it means
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.
Source
Thrown at kernel/model/asset_download.go:161
if err != nil {
return err
}
for _, file := range files {
if file.Path == rel {
if repoFileNeedsDownload(file) {
if err = checkAssetDownloadAccess(); err != nil {
return err
}
}
repo, repoErr := newSyncRepositoryWithAssetSourceLocked()
if repoErr != nil {
return repoErr
}
var downloaded bool
handleCloudError := cloudRepoErrorHandler()
if downloaded, err = repo.EnsureAsset(rel, newSyncContext()); err != nil {
handleCloudError(err)
return fmt.Errorf("%s: %w", Conf.Language(376), err)
}
if downloaded {
HandleAssetsChangeEvent(absPath)
}
return nil
}
}
return &os.PathError{Op: "open", Path: absPath, Err: os.ErrNotExist}
}
// EnsureAssetPrefixLocal 补齐逻辑清单中的目录内容,不能仅遍历本地磁盘。
func EnsureAssetPrefixLocal(absPrefix string) error {
prefix, err := dataRelativeAssetPath(absPrefix)
if err != nil {
return err
}
files, err := deferredSyncAssets()
if err != nil || len(files) == 0 {View on GitHub (pinned to 8641553a1f)
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
Defensive patterns
Strategy: try-catch
Try / catch
if err := model.EnsureAssetLocal(absPath); err != nil {
var root error = errors.Unwrap(err) // %w-wrapped cause
log.Println("asset download failed:", root)
// retry after connectivity/auth fix, or fall back to local-only assets
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Offline editing references an asset never synced; cloud object deleted or retention expired; wrong sync credentials; interrupted prior download leaving the asset absent.
Related errors
- Conf.Language(30) + " " + err.Error()
- Failed to install marketplace package [%s]: %s
- Conf.Language(123)
- Conf.Sync.Stat
- Conf.Language(37)
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/a2251524a6e342b0.
Report an issue: GitHub.