{"record":{"id":"333bcb23b511a89b","repo":"siyuan-note/siyuan","slug":"list-attribute-views-failed-w","errorCode":null,"errorMessage":"list attribute views failed: %w","messagePattern":"list attribute views failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/inline_style.go","lineNumber":409,"sourceCode":"\t\t\treturn nil\n\t\t}\n\t\tif readErr != nil {\n\t\t\treturn readErr\n\t\t}\n\t\tfor _, entry := range entries {\n\t\t\tif entry.IsDir() || filepath.Ext(entry.Name()) != \".json\" {\n\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}","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/inline_style.go#L391-L427","documentation":"workspaceAttributeViewCustomColorUsage walks storage/av to map which attribute views use which custom color indexes. If listing that directory fails (appendPaths error) and strict mode is on, the scan aborts with this wrapped error, causing the palette update to fail. In non-strict mode it only logs a warning.","triggerScenarios":"setInlineStylesData invoking the usage scan when storage/av cannot be listed — missing/unreadable directory, permission denied, or an error while walking individual .av files in strict mode.","commonSituations":"Corrupted or partially deleted storage/av directory; permission changes on the workspace folder; an unreadable .av file (disk error) during the walk with strict=true.","solutions":["Restore read access to <workspace>/data/storage/av and its .av files (chmod/chown).","Check the wrapped cause: if a specific .av file is unreadable, repair or restore it from backup/sync.","If the directory is genuinely gone, let the kernel recreate it by opening the workspace and creating an attribute view, then retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-check: storage/av must be listable\n// if _, err := os.ReadDir(filepath.Join(dataDir, \"storage\", \"av\")); err != nil { repair access first }","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"list attribute views failed\") {\n    // fix permissions or restore the .av file named in the wrapped cause, then retry\n}","preventionTips":["Keep storage/av and all .av files readable by the kernel process","Restore damaged .av files from sync/backup rather than deleting them","Re-create the directory by opening the workspace if it was removed"],"tags":["filesystem","attribute-view","directory-listing"],"backgroundTag":"file-read-failed","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"}