{"record":{"id":"5b9bf51093897fef","repo":"siyuan-note/siyuan","slug":"errfiltertoodeep","errorCode":"ErrFilterTooDeep","errorMessage":"filter nesting depth exceeds the maximum allowed","messagePattern":"filter nesting depth exceeds the maximum allowed","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/av.go","lineNumber":1349,"sourceCode":"\treturn\n}\n\nfunc GetAttributeViewI18n(key string) string {\n\treturn util.AttrViewLangs[util.Lang][key].(string)\n}\n\nvar (\n\tErrAttributeViewNotFound  = errors.New(\"attribute view not found\")\n\tErrInvalidAttributeViewID = errors.New(\"invalid attribute view id\")\n\tErrInvalidBoxID           = errors.New(\"invalid box id\")\n\tErrViewNotFound           = errors.New(\"view not found\")\n\tErrKeyNotFound            = errors.New(\"key not found\")\n\tErrItemNotFound           = errors.New(\"item not found\")\n\tErrWrongLayoutType        = errors.New(\"wrong layout type\")\n\tErrInvalidColumnAlign     = errors.New(\"invalid column align\")\n\tErrSpecTooNew             = errors.New(\"attribute view spec is too new\")\n\tErrRichTextSpecMismatch   = errors.New(\"attribute view rich text requires storage spec 9\")\n\tErrFilterTooDeep          = errors.New(\"filter nesting depth exceeds the maximum allowed\")\n)\n\nconst (\n\tNodeAttrNameAvs        = \"custom-avs\"                  // 用于标记块所属的属性视图，逗号分隔 av id\n\tNodeAttrView           = \"custom-sy-av-view\"           // 用于标记块所属的属性视图视图 view id Database block support specified view https://github.com/siyuan-note/siyuan/issues/10443\n\tNodeAttrVisibleViewIDs = \"custom-sy-av-visible-views\"  // 用于标记数据库块显示的视图 ID，逗号分隔\n\tNodeAttrContextFilter  = \"custom-sy-av-context-filter\" // 用于保存数据库块独有的上下文筛选配置\n\tNodeAttrViewStaticText = \"custom-sy-av-s-text\"         // 用于标记块所属的属性视图静态文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049\n\n\tNodeAttrViewNames = \"av-names\" // 用于临时标记块所属的属性视图名称，空格分隔\n)\n","sourceCodeStart":1331,"sourceCodeEnd":1361,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/av/av.go#L1331-L1361","documentation":"ErrFilterTooDeep is returned when a database filter tree nests more than MaxFilterNestingDepth (3) levels of filter groups. The kernel validates filter nesting depth (filter.go:220) to protect both the UI and recursive evaluation from pathological inputs.","triggerScenarios":"Saving or evaluating an attribute view filter JSON whose group nesting exceeds 3 levels; validateFilterNodeDepth during view deserialization or filter application; programmatically constructing deeply nested And/Or filter groups via the API or by editing .av JSON.","commonSituations":"A plugin or script generating filter expressions recursively without a depth cap; a sync/merge producing nested filter groups from two edited views; hand-edited .av JSON copied from another tool.","solutions":["Flatten the filter tree to at most 3 levels of nesting (merge same-operator groups, apply De Morgan transforms to reduce depth).","Split the query into multiple views or multiple saved filters instead of one deep tree.","If writing a generator, cap recursion depth at MaxFilterNestingDepth (av.MaxFilterNestingDepth == 3) before emitting groups.","Log which filter path is over depth (kernel already logs depth vs max) and inspect the view JSON at custom-sy-av filter nodes."],"exampleFix":"// before\nfilter := {group: {group: {group: {group: {...}}}}} // depth 4\n\n// after\n// flatten: same-operator children hoisted one level, depth <= av.MaxFilterNestingDepth (3)\nfilter := {group: {group: {group: {...}}}}","handlingStrategy":"validation","validationCode":"func filterDepthOK(f *av.Filter) bool { return maxDepth(f) <= av.MaxFilterNestingDepth }","typeGuard":null,"tryCatchPattern":"if err := applyFilters(view); errors.Is(err, av.ErrFilterTooDeep) {\n\t// flatten filter groups and retry\n}","preventionTips":["Cap generated filter nesting at av.MaxFilterNestingDepth (3)","Prefer flat same-operator groups over mixed and/or chains","Test generated filters with validateFilterNodeDepth before persisting"],"tags":["attribute-view","filter","recursion-limit","validation","siyuan-kernel"],"backgroundTag":"value-out-of-range","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}