siyuan-note/siyuan · warning

ErrFilterTooDeep

ErrFilterTooDeep

Error message

filter nesting depth exceeds the maximum allowed

What it means

ErrFilterTooDeep is returned by validateFilterNodeDepth when a filter expression's nesting depth exceeds MaxFilterNestingDepth. The library caps recursion depth to protect the stack when evaluating or validating deeply nested grouped filters.

Solutions

  1. Flatten the filter tree (convert equivalent nested AND/OR groups into flat lists) before saving
  2. Track depth during filter construction and refuse/flatten beyond MaxFilterNestingDepth
  3. Split an unavoidably deep query into multiple saved views or sequential operations

Example fix

// before
var build func(rules []Rule) *Filter // unbounded recursion
// after
const maxDepth = MaxFilterNestingDepth
func build(rules []Rule, depth int) (*Filter, error) {
    if depth > maxDepth {
        return nil, av.ErrFilterTooDeep
    }
    ...
}
Defensive patterns

Strategy: validation

Validate before calling

if filterDepth(filter) > av.MaxFilterNestingDepth {
    filter = flattenFilter(filter)
}

Prevention

When it happens

Trigger: Saving/validating an attribute view whose filter tree nests groups (AND/OR) deeper than MaxFilterNestingDepth; importing or programmatically generating filters by recursive combination without depth checks.

Common situations: Plugin building filters recursively (e.g. folding user rules into nested groups) without depth limiting; importing a database exported from a tool with unlimited nesting; chained merges of filter trees doubling depth each time.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at kernel/av/av.go:1393

	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)