{"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/9f775e8a12daef8255556097396f9b2739078892/kernel/model/inline_style.go#L398-L434","documentation":"The custom-color usage scan also reads the workspace data directory (util.DataDir) to enumerate per-notebook folders. If os.ReadDir fails for a reason other than not-exist and strict mode is enabled, the scan aborts with this wrapped error and the palette update fails.","triggerScenarios":"setInlineStylesData triggering workspaceAttributeViewCustomColorUsage while the workspace data directory is unreadable — permission denied, I/O error, or DataDir replaced by a non-directory in strict mode.","commonSituations":"Workspace data folder deleted or unmounted while the kernel runs; permission tightened on the workspace root; DataDir path pointing at a file after a bad manual move of the workspace.","solutions":["Verify the workspace data directory exists and is readable by the kernel process (ls/chmod/chown).","Remount or restore the workspace volume if it was unmounted or moved.","If data/ was replaced by a file, restore the real directory from backup or sync and restart the kernel."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"info, err := os.Stat(util.DataDir)\nif err != nil || !info.IsDir() {\n    // workspace data directory missing or not a directory; repair before calling the API\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"list workspace data directory failed\") {\n    // verify/remount the workspace volume, then retry the palette update\n}","preventionTips":["Do not move or rename the workspace data directory while the kernel is running","Ensure the workspace volume stays mounted during kernel operation","Keep workspace root permissions readable/executable for the kernel process user"],"tags":["filesystem","directory-listing","workspace"],"backgroundTag":"directory-not-found","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}