{"record":{"id":"daf0cc9c3eeedd2a","repo":"siyuan-note/siyuan","slug":"walk-global-assets-s-failed-w","errorCode":null,"errorMessage":"walk global assets [%s] failed: %w","messagePattern":"walk global assets \\[(.+?)\\] failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/assets.go","lineNumber":2816,"sourceCode":"\t\t}\n\n\t\tif filelock.IsHidden(assetPath) {\n\t\t\t// 清理资源文件时忽略隐藏文件 Ignore hidden files when cleaning unused assets https://github.com/siyuan-note/siyuan/issues/12172\n\t\t\treturn nil\n\t\t}\n\n\t\trelPath, relErr := assetPathMapKey(dataAssetsAbsPath, assetPath, d.IsDir())\n\t\tif relErr != nil {\n\t\t\treturn relErr\n\t\t}\n\t\tassetsAbsPathMap[relPath] = assetPath\n\t\treturn nil\n\t})\n\tif walkErr != nil {\n\t\tif os.IsNotExist(walkErr) {\n\t\t\treturn\n\t\t}\n\t\treturn nil, fmt.Errorf(\"walk global assets [%s] failed: %w\", dataAssetsAbsPath, walkErr)\n\t}\n\treturn\n}\n\nfunc assetPathMapKey(assetsDirPath, assetPath string, isDir bool) (ret string, err error) {\n\trelPath, err := filepath.Rel(assetsDirPath, assetPath)\n\tif err != nil {\n\t\treturn\n\t}\n\trelPath = filepath.ToSlash(relPath)\n\tif relPath == \".\" || relPath == \"..\" || strings.HasPrefix(relPath, \"../\") || path.IsAbs(relPath) {\n\t\terr = fmt.Errorf(\"asset path [%s] is outside assets directory [%s]\", assetPath, assetsDirPath)\n\t\treturn\n\t}\n\n\tret = path.Join(\"assets\", relPath)\n\tif isDir {\n\t\tret += \"/\"","sourceCodeStart":2798,"sourceCodeEnd":2834,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/assets.go#L2798-L2834","documentation":"Walking the global data/assets directory failed while collecting the workspace-wide asset list. Unlike the notebook walk, a file-not-found error here is tolerated (the global assets folder may not exist yet); any other error is returned wrapped with the assets path, failing the entire asset listing.","triggerScenarios":"filelock.Walk on util.GetDataAssetsAbsPath() returns a non-ENOENT error: permission denied on data/assets, I/O error mid-enumeration, the path became inaccessible while the listing ran (drive unmounted, sync conflict).","commonSituations":"Workspace on an external/network drive that disconnected; data/assets locked by another process; permission mismatch after copying a workspace as a different user; antivirus interference during enumeration.","solutions":["Verify the data/assets directory exists and is readable by the SiYuan process","Fix OS permissions on the workspace data directory","Reconnect/remount the drive hosting the workspace if it was unmounted","Inspect the wrapped walkErr in kernel logs to find the failing path","Create the data/assets folder if it is missing and the error persists after ruling out ENOENT handling"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"import fs from 'fs';\nif (!fs.existsSync(dataAssetsAbsPath)) { /* missing global assets is tolerated; proceed */ }","typeGuard":null,"tryCatchPattern":"try { await getAllAssets() } catch (e) {\n  if (!String(e.message).includes('walk global assets')) throw e;\n  // fall back to per-notebook asset listing\n  assets = await listNotebookAssetsOnly();\n}","preventionTips":["Never delete or lock data/assets while the app is running","Keep the workspace on a reliably mounted local drive","Watch kernel logs for the wrapped walkErr to catch drive/permission issues early"],"tags":["filesystem","walk","assets"],"backgroundTag":"directory-not-found","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"}