{"record":{"id":"a5d736a3ac5699b2","repo":"siyuan-note/siyuan","slug":"list-workspace-data-directory-failed-w","errorCode":null,"errorMessage":"list workspace data directory failed: %w","messagePattern":"list workspace data directory failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/inline_style.go","lineNumber":416,"sourceCode":"\t\t\t\tcontinue\n\t\t\t}\n\t\t\tavID := strings.TrimSuffix(entry.Name(), filepath.Ext(entry.Name()))\n\t\t\tif ast.IsNodeIDPattern(avID) {\n\t\t\t\tpaths = append(paths, filepath.Join(dir, entry.Name()))\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\tif err = appendPaths(filepath.Join(util.DataDir, \"storage\", \"av\")); err != nil {\n\t\tif strict {\n\t\t\treturn nil, fmt.Errorf(\"list attribute views failed: %w\", err)\n\t\t}\n\t\tlogging.LogWarnf(\"list attribute views for custom color refresh failed: %s\", err)\n\t}\n\tentries, readErr := os.ReadDir(util.DataDir)\n\tif readErr != nil && !os.IsNotExist(readErr) {\n\t\tif strict {\n\t\t\treturn nil, fmt.Errorf(\"list workspace data directory failed: %w\", readErr)\n\t\t}\n\t\tlogging.LogWarnf(\"list workspace data directory for custom color refresh failed: %s\", readErr)\n\t}\n\tfor _, entry := range entries {\n\t\tif !entry.IsDir() || !ast.IsNodeIDPattern(entry.Name()) {\n\t\t\tcontinue\n\t\t}\n\t\tif err = appendPaths(filepath.Join(util.DataDir, entry.Name(), \"storage\", \"av\")); err != nil {\n\t\t\tif strict {\n\t\t\t\treturn nil, fmt.Errorf(\"list notebook attribute views [%s] failed: %w\", entry.Name(), err)\n\t\t\t}\n\t\t\tlogging.LogWarnf(\"list notebook attribute views [%s] for custom color refresh failed: %s\",\n\t\t\t\tentry.Name(), err)\n\t\t}\n\t}\n\tsort.Strings(paths)\n\tfor _, path := range paths {\n\t\tavID, indexes, readErr := av.ReadAttributeViewCustomColorUsageByPath(path)","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/inline_style.go#L398-L434","documentation":"Beyond storage/av, custom color usage discovery also scans workspace data directories (each notebook is a directory named by node ID, checked with ast.IsNodeIDPattern). In strict mode, a ReadDir failure on util.DataDir that is not os.IsNotExist aborts with this wrapped error, preventing an incomplete usage analysis.","triggerScenarios":"util.DataDir unreadable due to permissions; DataDir exists but ReadDir fails with EIO/EACCES (not ENOENT, which is tolerated); DataDir replaced by a file or a broken mount.","commonSituations":"Workspace data directory on a failed/unmounted network share; running the kernel without read access to the data dir after a user switch; filesystem corruption.","solutions":["Verify util.DataDir (the workspace data/ folder) exists, is a directory, and is readable by the kernel process","Remount or repair the volume hosting the workspace if ReadDir reports I/O errors","Fix ownership/permissions after restoring or copying the workspace (e.g. chown -R) and retry","If the error is transient (mount reconnected), simply retry the palette update"],"exampleFix":"# before\ndrwxr--r-- root data/   # kernel user cannot read\n# after\nchown -R siyuan:siyuan data/ && chmod -R u+rwX data/","handlingStrategy":"fallback","validationCode":"if fi, err := os.Stat(util.DataDir); err != nil || !fi.IsDir() {\n    return fmt.Errorf(\"workspace data dir unusable: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"usage, err := model.WorkspaceAttributeViewCustomColorUsage(true)\nif err != nil {\n    log.Warnf(\"skipping palette changes: workspace data dir unreadable: %v\", err)\n    return\n}","preventionTips":["Verify the workspace data directory is mounted and readable before palette operations","Repair or remount failing volumes promptly; tolerate ENOENT but treat EACCES/EIO as blocking","Standardize kernel process user and chown -R the workspace after any restore"],"tags":["go","filesystem","readdir","workspace"],"backgroundTag":"directory-not-found","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}