siyuan-note/siyuan · error

walk notebook assets

Error message

walk notebook assets [%s] failed: %w

What it means

While building the list of all assets, walking a notebook's assets directory failed. The kernel walks each notebook's assets folder (via filelock.Walk) plus the global data/assets directory; any per-notebook walk error aborts the whole asset listing and is wrapped with the notebook's absolute path for diagnosis.

Solutions

  1. Check the reported notebook directory exists and is readable/executable by the SiYuan process
  2. Repair or remove the broken notebook folder (or re-sync the notebook) so the assets directory is accessible
  3. Fix OS-level permissions on the workspace data/notebooks tree
  4. Check kernel logs for the wrapped walkErr to identify the exact failing entry
  5. Exclude the problematic notebook temporarily and re-run the asset listing
Defensive patterns

Strategy: try-catch

Validate before calling

import fs from 'fs';
// verify each notebook assets dir exists and is readable before listing
const ok = fs.existsSync(nbAbsPath) && fs.statSync(nbAbsPath).isDirectory();

Try / catch

try { await getAllAssets() } catch (e) {
  const m = e.message.match(/walk notebook assets \\[(.+?)\\]/);
  if (m) { fixOrExcludeNotebook(m[1]); }
}

Prevention

When it happens

Trigger: filelock.Walk on a notebook's assets dir returns an error — permission denied on the directory, the path disappeared mid-walk (sync deleted it), symlink loops, or an underlying filesystem I/O error while enumerating entries.

Common situations: Broken or inaccessible notebook folder after a failed sync/restore; permission changes after moving the workspace between machines or users; OneDrive/Dropbox on-demand files erroring during enumeration; corrupted filesystem.

Related errors


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

Appendix: source

Thrown at kernel/model/assets.go:2779

							return filepath.SkipDir
						}
						return nil
					}
					relPath, relErr := assetPathMapKey(assetsDirPath, assetPath, d.IsDir())
					if relErr != nil {
						return relErr
					}
					assetsAbsPathMap[relPath] = assetPath
					return nil
				}); nestedWalkErr != nil {
					return nestedWalkErr
				}
				return filepath.SkipDir
			}
			return nil
		})
		if walkErr != nil {
			return nil, fmt.Errorf("walk notebook assets [%s] failed: %w", notebookAbsPath, walkErr)
		}
	}

	// 全局 assets
	dataAssetsAbsPath := util.GetDataAssetsAbsPath()
	walkErr := filelock.Walk(dataAssetsAbsPath, func(assetPath string, d fs.DirEntry, walkErr error) error {
		if walkErr != nil {
			return walkErr
		}
		if dataAssetsAbsPath == assetPath {
			return nil
		}

		if isSkipFile(d.Name()) {
			if d.IsDir() {
				return filepath.SkipDir
			}
			return nil

View on GitHub (pinned to 9f775e8a12)