siyuan-note/siyuan · error
list notebook attribute views
Error message
list notebook attribute views [%s] failed: %w
What it means
During a workspace-wide scan of attribute-view custom color usage, the kernel could not list the `storage/av` directory of a notebook (a directory whose name is a valid node ID) under the data directory. This is wrapped from the underlying os.ReadDir failure, which is anything other than the tolerated not-exist case. In strict mode the whole custom-color usage collection aborts with this error; in non-strict mode it is only logged as a warning.
Solutions
- Check and fix filesystem permissions on <workspace>/data/<notebookID>/storage (readable + executable for the kernel process)
- Verify <data>/<notebookID> is a real directory, not a file or broken symlink
- Re-run the operation; if strict mode keeps failing, check the wrapped cause (%w) for the actual OS error
Example fix
// before
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)
}
// after: pass strict=false or handle the returned error gracefully
usage, err := workspaceAttributeViewCustomColorUsage(false)
if err != nil {
logging.LogWarnf("skip custom color refresh: %s", err)
} Defensive patterns
Strategy: try-catch
Validate before calling
const nbDir = `${dataDir}/${notebookID}/storage/av`;
try { fs.accessSync(nbDir, fs.constants.R_OK | fs.constants.X_OK); } catch (e) { /* fix perms before calling */ } Try / catch
try {
await fetchPost('/api/attr/setInlineStylesData', payload);
} catch (e) {
if (String(e).includes('list notebook attribute views')) {
logging.warn(`skipping AV color refresh for a notebook: ${e.cause ?? e}`);
}
} Prevention
- Keep notebook directories owned by the user running the SiYuan kernel
- Do not replace notebook directories with files or dangling symlinks
- Ensure storage/av subdirectories survive sync tools intact
When it happens
Trigger: Calling setInlineStylesData (via SetInlineStylesData or SetWorkspaceAVPalette / replaceWorkspaceAVPalette flows) when os.ReadDir on <data>/<notebookID>/storage/av fails with a permission or I/O error for some notebook, while strict=true.
Common situations: Notebook directory with restrictive file permissions (e.g. copied as root onto a user workspace), a file named like a notebook ID replacing the directory, disk errors, or sync tools leaving broken directories.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- can not open file, just support open folder only
- can not remove [ ] caused by it is not a dir
- Conf.Language(14) (copy resource failed: )
- create AI editor actions directory failed
- create conf dir failed
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/828274f0fbfbb7e1.
Report an issue: GitHub.
Appendix: 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 9f775e8a12)