siyuan-note/siyuan · error

cannot inspect attribute view in notebook

Error message

cannot inspect attribute view in notebook %s, document %s: %w

What it means

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.

Solutions

  1. Fix filesystem permissions on data/storage/av so files are statable
  2. Replace the non-regular or broken entry with a real .json definition file
  3. Re-sync or restore the workspace so storage/av is consistent with the documents
  4. Inspect the wrapped inner error (%w) to identify the exact underlying cause

Example fix

// before
// error: cannot inspect attribute view in notebook 20240101... document /20240101120000-xyz.sy
//   caused by: attribute view definition is not a regular file: ...
// after
os.Remove("data/storage/av/<broken-entry>")
// restore the regular .json file from backup/sync
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure storage/av is readable and contains only regular files before scanning
infos, err := os.ReadDir(filepath.Join(dataDir, "storage", "av"))
if err != nil {
	// fix permissions/existence first
}

Try / catch

// unwrap the wrapped cause to target the underlying problem
if err := plan.Scan(); err != nil {
	var nbErr interface{ Unwrap() error }
	if errors.As(err, &target) { /* inspect cause */ }
	log.Printf("notebook/doc-specific AV failure: %v", err)
}

Prevention

When it happens

Trigger: 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.

Common situations: Permission problems on storage/av; the AV definition path is a symlink or directory; the data directory was partially restored so metadata is inconsistent.

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


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/3a51adb679d88dfa. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/asset_relink.go:402

					}
				}
				availability[n.AttributeViewID] = reason
			}
			if reason != "" {
				name, loaded := boxNames[tree.Box]
				if !loaded {
					name = (&Box{ID: tree.Box}).GetConf().Name
					boxNames[tree.Box] = name
				}
				p.result.UnavailableAttributeViews = append(p.result.UnavailableAttributeViews, apicontract.UnavailableAssetAttributeView{
					AvID: n.AttributeViewID, Notebook: tree.Box, NotebookName: name, RootID: tree.Root.ID,
					BlockID: n.ID, Path: tree.Path, HPath: tree.HPath, Reason: reason,
				})
			}
			return ast.WalkContinue
		})
		if checkErr != nil {
			return fmt.Errorf("cannot inspect attribute view in notebook %s, document %s: %w", tree.Box, tree.Path, checkErr)
		}
	}
	return nil
}

func (p *assetRelinkPlan) scanAnnotation(oldAbs, newAbs string) error {
	if oldAbs == "" {
		for i := range p.result.References {
			if p.result.References[i].Type == "annotation" && p.result.References[i].OldPath == p.oldPath {
				p.result.References[i].Relinkable, p.result.References[i].Reason = false, "annotation_source_missing"
			}
		}
		return nil
	}
	source := oldAbs + ".sya"
	if err := p.observe(source); err != nil {
		return err
	}

View on GitHub (pinned to 9f775e8a12)