siyuan-note/siyuan · error
ErrViewNotFound
ErrViewNotFound
Error message
view not found
What it means
ErrViewNotFound is thrown when the attribute view JSON file does not exist on disk (parseAttributeViewByPathInBoxWithOptions checks filelock.IsExist first) or when the requested view id is absent from a loaded attribute view. It signals the client is referencing a view (or the whole database file) that is not present.
Solutions
- Confirm the .av JSON file exists at the expected path in the workspace
- Re-fetch the attribute view to obtain current view ids instead of reusing cached ones
- Recreate the view or relink the database block if the file was permanently lost
Defensive patterns
Strategy: try-catch
Validate before calling
if !filelock.IsExist(avJSONPath) {
return errors.New("attribute view file missing")
} Try / catch
if err := renderAttrView(...); err != nil {
if errors.Is(err, av.ErrViewNotFound) {
// refresh view list or notify user the view was deleted
}
} Prevention
- Refetch view ids after any sync/deletion instead of caching
- Check file existence before direct-path operations
- Handle remote deletion of views gracefully
When it happens
Trigger: Rendering an attribute view (renderAttrView) whose JSON path no longer exists; syncing table column widths or folding groups for a view id that was deleted; getAttrViewOperationView with a stale view id after the view was removed or the file was lost in an interrupted sync.
Common situations: A database block references a view deleted on another device before sync completed; the .av file was manually deleted while the block attribute custom-avs still points to it; plugin caching an old view id across a spec migration.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- attribute view not found
- 376
- 377
- [/api/av/batchSetAttributeViewBlockAttrs] parameter [rowID]…
- at least one visible view is required
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/ba1cdf7531edd04c.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/av/av.go:1386
ret = filepath.Join(av, avID+".json")
if !gulu.File.IsDir(av) {
if err := os.MkdirAll(av, 0755); err != nil {
logging.LogErrorf("create attribute view dir failed: %s", err)
return
}
}
return
}
func GetAttributeViewI18n(key string) string {
return util.AttrViewLangs[util.Lang][key].(string)
}
var (
ErrAttributeViewNotFound = errors.New("attribute view not found")
ErrInvalidAttributeViewID = errors.New("invalid attribute view id")
ErrInvalidBoxID = errors.New("invalid box id")
ErrViewNotFound = errors.New("view not found")
ErrKeyNotFound = errors.New("key not found")
ErrItemNotFound = errors.New("item not found")
ErrWrongLayoutType = errors.New("wrong layout type")
ErrInvalidColumnAlign = errors.New("invalid column align")
ErrSpecTooNew = errors.New("attribute view spec is too new")
ErrRichTextSpecMismatch = errors.New("attribute view rich text requires storage spec 9")
ErrFilterTooDeep = errors.New("filter nesting depth exceeds the maximum allowed")
)
const (
NodeAttrNameAvs = "custom-avs" // 用于标记块所属的属性视图,逗号分隔 av id
NodeAttrView = "custom-sy-av-view" // 用于标记块所属的属性视图视图 view id Database block support specified view https://github.com/siyuan-note/siyuan/issues/10443
NodeAttrVisibleViewIDs = "custom-sy-av-visible-views" // 用于标记数据库块显示的视图 ID,逗号分隔
NodeAttrContextFilter = "custom-sy-av-context-filter" // 用于保存数据库块独有的上下文筛选配置
NodeAttrViewStaticText = "custom-sy-av-s-text" // 用于标记块所属的属性视图静态文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049
NodeAttrViewNames = "av-names" // 用于临时标记块所属的属性视图名称,空格分隔
)View on GitHub (pinned to 9f775e8a12)