siyuan-note/siyuan · error
list notebook attribute views [%s] failed: %w
Error message
list notebook attribute views [%s] failed: %w
What it means
workspaceAttributeViewCustomColorUsage walks every notebook under DataDir and lists the storage/av directory of each to find attribute-view files whose custom color usage must be refreshed. When listing a notebook's av directory fails and strict mode is on, the whole operation is aborted and this wrapped error is returned to setInlineStylesData. In non-strict mode the failure is only logged as a warning and the remaining notebooks are still processed.
Source
Thrown at kernel/model/inline_style.go:426
if strict {
return nil, fmt.Errorf("list attribute views failed: %w", err)
}
logging.LogWarnf("list attribute views for custom color refresh failed: %s", err)
}
entries, readErr := os.ReadDir(util.DataDir)
if readErr != nil && !os.IsNotExist(readErr) {
if strict {
return nil, fmt.Errorf("list workspace data directory failed: %w", readErr)
}
logging.LogWarnf("list workspace data directory for custom color refresh failed: %s", readErr)
}
for _, entry := range entries {
if !entry.IsDir() || !ast.IsNodeIDPattern(entry.Name()) {
continue
}
if err = appendPaths(filepath.Join(util.DataDir, entry.Name(), "storage", "av")); err != nil {
if strict {
return nil, fmt.Errorf("list notebook attribute views [%s] failed: %w", entry.Name(), err)
}
logging.LogWarnf("list notebook attribute views [%s] for custom color refresh failed: %s",
entry.Name(), err)
}
}
sort.Strings(paths)
for _, path := range paths {
avID, indexes, readErr := av.ReadAttributeViewCustomColorUsageByPath(path)
if readErr != nil {
if strict {
return nil, fmt.Errorf("read attribute view custom color usage [%s] failed: %w", avID, readErr)
}
logging.LogWarnf("read attribute view custom color usage [%s] for refresh failed: %s", avID, readErr)
continue
}
used := ret[avID]
if used == nil {
used = map[int]struct{}{}View on GitHub (pinned to 8641553a1f)
Solutions
- Check that <workspace>/data/<notebookID>/storage/av exists and is readable; recreate the directory or fix its permissions
- If the folder is a stale orphan (ID-shaped directory that is not a notebook), remove it or move it out of data/
- Retry the operation after fixing the filesystem; the error wraps the underlying os error which names the exact cause
- If non-critical, use the non-strict path where the failure is only logged and other notebooks continue processing
Example fix
// before: notebook dir exists but storage/av missing -> strict call aborts
if err = appendPaths(filepath.Join(util.DataDir, entry.Name(), "storage", "av")); err != nil {
return nil, fmt.Errorf("list notebook attribute views [%s] failed: %w", entry.Name(), err)
}
// after: ensure the directory exists (or skip gracefully) before the strict scan
os.MkdirAll(filepath.Join(util.DataDir, entry.Name(), "storage", "av"), 0755) Defensive patterns
Strategy: try-catch
Validate before calling
const fs = require('fs');
function avDirReadable(workspace, notebookID) {
try { fs.accessSync(`${workspace}/data/${notebookID}/storage/av`, fs.constants.R_OK); return true; }
catch { return false; }
} Try / catch
try {
await api.setInlineStylesData(payload);
} catch (e) {
if (String(e).includes('list notebook attribute views')) {
// inspect wrapped OS error, repair or skip the notebook dir, then retry
} else throw e;
} Prevention
- Never delete storage/av subdirectories manually while SiYuan is running
- Keep uniform permissions across the workspace data directory
- Exclude the workspace from aggressive cloud-sync clients that create half-synced directories
When it happens
Trigger: Calling the inline-styles update path (setInlineStylesData) that triggers workspaceAttributeViewCustomColorUsage with strict=true, while os.ReadDir on <data>/<notebookID>/storage/av fails: the notebook directory exists but storage/av is missing or unreadable, or an OS-level permission/I/O error occurs on that directory.
Common situations: A notebook folder left half-deleted (storage/av removed manually or by a partial sync), restrictive file permissions after copying the workspace between users/machines, cloud-sync clients placing the directory in a broken state, or a directory named like a notebook ID that is not a real notebook.
Related errors
- list attribute views failed: %w
- load tree failed: %s
- attribute view not found
- invalid attribute view id
- view not found
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/828274f0fbfbb7e1.
Report an issue: GitHub.