siyuan-note/siyuan · error
attribute view definition is not a regular file
Error message
attribute view definition is not a regular file: %s
What it means
When checking whether an attribute view used in a document has a local definition, the scanner lstats storage/av/<id>.json. If the entry exists but is not a regular file (directory, symlink, device), the walk aborts because availability cannot be determined safely.
Solutions
- Remove the non-regular entry and restore a real .json definition file at that path
- If it is a stray directory, delete it and let the app recreate the definition
- Fix the sync/backup tool so it dereferences symlinks and never creates directories at that path
Example fix
// before
// data/storage/av/20240101120000-abc123.json is a directory
// after
os.RemoveAll("data/storage/av/20240101120000-abc123.json")
// restore the real file from history/sync Defensive patterns
Strategy: validation
Validate before calling
// pre-check every AV definition referenced by documents
info, err := os.Lstat(filepath.Join(dataDir, "storage", "av", avID+".json"))
if err == nil && !info.Mode().IsRegular() {
// replace the non-regular entry with a real file
} Prevention
- Do not create directories or symlinks named like AV ids under storage/av
- Fix sync tooling that materializes files as symlinks or directories
- Audit storage/av for non-regular entries after external restores
When it happens
Trigger: A document block references an attribute view whose storage/av/<id>.json path exists but is a directory or symlink instead of a regular file; discovered during the ast.Walk availability check in scanViews.
Common situations: A directory was accidentally created named like an AV id (e.g. by a script appending '/'); sync or backup tooling replaced the file with a symlink; filesystem corruption.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- symbolic attribute view is not supported
- asset path contains an unresolved symbolic link
- asset path resolves outside notebook assets directory
- cannot inspect attribute view in notebook
- encrypted attribute view in global storage
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/99e2916b3433de0a.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/asset_relink.go:382
}
reason, checked := availability[n.AttributeViewID]
if !checked {
if !ast.IsNodeIDPattern(n.AttributeViewID) {
reason = "invalid_id"
} else {
abs := filepath.Join(dir, n.AttributeViewID+".json")
if checkErr = p.observe(abs); checkErr != nil {
return ast.WalkStop
}
info, statErr := os.Lstat(abs)
if os.IsNotExist(statErr) {
// 数据库定义不参与资源按需下载;缺失定义作为历史残留上报,保留数据库块。
reason = "missing_definition"
} else if statErr != nil {
checkErr = statErr
return ast.WalkStop
} else if !info.Mode().IsRegular() {
checkErr = fmt.Errorf("attribute view definition is not a regular file: %s", abs)
return ast.WalkStop
}
}
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
})View on GitHub (pinned to 9f775e8a12)