siyuan-note/siyuan · error

walk global assets [ ] failed

Error message

walk global assets [%s] failed: %w

What it means

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.

Solutions

  1. Verify the data/assets directory exists and is readable by the SiYuan process
  2. Fix OS permissions on the workspace data directory
  3. Reconnect/remount the drive hosting the workspace if it was unmounted
  4. Inspect the wrapped walkErr in kernel logs to find the failing path
  5. Create the data/assets folder if it is missing and the error persists after ruling out ENOENT handling
Defensive patterns

Strategy: fallback

Validate before calling

import fs from 'fs';
if (!fs.existsSync(dataAssetsAbsPath)) { /* missing global assets is tolerated; proceed */ }

Try / catch

try { await getAllAssets() } catch (e) {
  if (!String(e.message).includes('walk global assets')) throw e;
  // fall back to per-notebook asset listing
  assets = await listNotebookAssetsOnly();
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/daf0cc9c3eeedd2a. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/assets.go:2816

		}

		if filelock.IsHidden(assetPath) {
			// 清理资源文件时忽略隐藏文件 Ignore hidden files when cleaning unused assets https://github.com/siyuan-note/siyuan/issues/12172
			return nil
		}

		relPath, relErr := assetPathMapKey(dataAssetsAbsPath, assetPath, d.IsDir())
		if relErr != nil {
			return relErr
		}
		assetsAbsPathMap[relPath] = assetPath
		return nil
	})
	if walkErr != nil {
		if os.IsNotExist(walkErr) {
			return
		}
		return nil, fmt.Errorf("walk global assets [%s] failed: %w", dataAssetsAbsPath, walkErr)
	}
	return
}

func assetPathMapKey(assetsDirPath, assetPath string, isDir bool) (ret string, err error) {
	relPath, err := filepath.Rel(assetsDirPath, assetPath)
	if err != nil {
		return
	}
	relPath = filepath.ToSlash(relPath)
	if relPath == "." || relPath == ".." || strings.HasPrefix(relPath, "../") || path.IsAbs(relPath) {
		err = fmt.Errorf("asset path [%s] is outside assets directory [%s]", assetPath, assetsDirPath)
		return
	}

	ret = path.Join("assets", relPath)
	if isDir {
		ret += "/"

View on GitHub (pinned to 9f775e8a12)