{"record":{"id":"3a51adb679d88dfa","repo":"siyuan-note/siyuan","slug":"cannot-inspect-attribute-view-in-notebook-s-document-s-w","errorCode":null,"errorMessage":"cannot inspect attribute view in notebook %s, document %s: %w","messagePattern":"cannot inspect attribute view in notebook (.+?), document (.+?): %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/asset_relink.go","lineNumber":402,"sourceCode":"\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tavailability[n.AttributeViewID] = reason\n\t\t\t}\n\t\t\tif reason != \"\" {\n\t\t\t\tname, loaded := boxNames[tree.Box]\n\t\t\t\tif !loaded {\n\t\t\t\t\tname = (&Box{ID: tree.Box}).GetConf().Name\n\t\t\t\t\tboxNames[tree.Box] = name\n\t\t\t\t}\n\t\t\t\tp.result.UnavailableAttributeViews = append(p.result.UnavailableAttributeViews, apicontract.UnavailableAssetAttributeView{\n\t\t\t\t\tAvID: n.AttributeViewID, Notebook: tree.Box, NotebookName: name, RootID: tree.Root.ID,\n\t\t\t\t\tBlockID: n.ID, Path: tree.Path, HPath: tree.HPath, Reason: reason,\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn ast.WalkContinue\n\t\t})\n\t\tif checkErr != nil {\n\t\t\treturn fmt.Errorf(\"cannot inspect attribute view in notebook %s, document %s: %w\", tree.Box, tree.Path, checkErr)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (p *assetRelinkPlan) scanAnnotation(oldAbs, newAbs string) error {\n\tif oldAbs == \"\" {\n\t\tfor i := range p.result.References {\n\t\t\tif p.result.References[i].Type == \"annotation\" && p.result.References[i].OldPath == p.oldPath {\n\t\t\t\tp.result.References[i].Relinkable, p.result.References[i].Reason = false, \"annotation_source_missing\"\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\tsource := oldAbs + \".sya\"\n\tif err := p.observe(source); err != nil {\n\t\treturn err\n\t}","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/asset_relink.go#L384-L420","documentation":"While walking trees, any per-document checkErr raised while inspecting a node's attribute view (stat failures, non-regular definition files, observe errors) is wrapped with the notebook ID and document path so the failure is attributable. The scan aborts because it cannot produce a trustworthy relink plan without knowing each AV's availability.","triggerScenarios":"During scan -> scanViews, the walker hits an attribute-view node whose definition cannot be inspected (os.Lstat error on storage/av/<id>.json, non-regular file, or p.observe failure) and the walker returns ast.WalkStop.","commonSituations":"Permission problems on storage/av; the AV definition path is a symlink or directory; the data directory was partially restored so metadata is inconsistent.","solutions":["Fix filesystem permissions on data/storage/av so files are statable","Replace the non-regular or broken entry with a real .json definition file","Re-sync or restore the workspace so storage/av is consistent with the documents","Inspect the wrapped inner error (%w) to identify the exact underlying cause"],"exampleFix":"// before\n// error: cannot inspect attribute view in notebook 20240101... document /20240101120000-xyz.sy\n//   caused by: attribute view definition is not a regular file: ...\n// after\nos.Remove(\"data/storage/av/<broken-entry>\")\n// restore the regular .json file from backup/sync","handlingStrategy":"try-catch","validationCode":"// ensure storage/av is readable and contains only regular files before scanning\ninfos, err := os.ReadDir(filepath.Join(dataDir, \"storage\", \"av\"))\nif err != nil {\n\t// fix permissions/existence first\n}","typeGuard":null,"tryCatchPattern":"// unwrap the wrapped cause to target the underlying problem\nif err := plan.Scan(); err != nil {\n\tvar nbErr interface{ Unwrap() error }\n\tif errors.As(err, &target) { /* inspect cause */ }\n\tlog.Printf(\"notebook/doc-specific AV failure: %v\", err)\n}","preventionTips":["Keep data/storage/av permissions consistent for the kernel user","Restore data directories atomically so documents and storage/av stay consistent","Read the wrapped inner error to identify the exact stat/observe failure"],"tags":["attribute-view","filesystem","walk","diagnostics"],"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"}