gastownhall/beads · error

priority != requires predicate filtering

Error message

priority != requires predicate filtering

What it means

The IssueFilter struct backing queries has PriorityMin/PriorityMax range fields but no direct "not equal" representation for priority, so applyPriorityFilter explicitly refuses the != operator and tells the caller predicate filtering is required. This is a deliberate capability limit of the declarative filter, not a parsing bug.

Source

Thrown at internal/query/evaluator.go:239

	}
	return nil
}

func (e *Evaluator) applyPriorityFilter(comp *ComparisonNode, filter *types.IssueFilter) error {
	priority, err := strconv.Atoi(comp.Value)
	if err != nil {
		return fmt.Errorf("invalid priority value: %s", comp.Value)
	}
	if priority < 0 || priority > 4 {
		return fmt.Errorf("priority must be between 0 and 4")
	}

	switch comp.Op {
	case OpEquals:
		filter.Priority = &priority
	case OpNotEquals:
		// For != we need predicate filtering
		return fmt.Errorf("priority != requires predicate filtering")
	case OpLess:
		// priority < X means PriorityMax = X-1
		max := priority - 1
		if max < 0 {
			return fmt.Errorf("priority < %d matches nothing", priority)
		}
		filter.PriorityMax = &max
	case OpLessEq:
		filter.PriorityMax = &priority
	case OpGreater:
		// priority > X means PriorityMin = X+1
		min := priority + 1
		if min > 4 {
			return fmt.Errorf("priority > %d matches nothing", priority)
		}
		filter.PriorityMin = &min
	case OpGreaterEq:
		filter.PriorityMin = &priority

View on GitHub (pinned to 71377f2769)

Solutions

  1. Use the Go API for predicate filtering: fetch with types.IssueFilter{Priority: ...} variants and post-filter in code: `if issue.Priority != want { skip }`.
  2. Approximate with a range when the value is at the edge, e.g. `priority != 0` ≈ `priority >= 1`.
  3. Otherwise enumerate the allowed values OR'd together (if the query language supports OR for priority in your build).

Example fix

// before
"priority != 2"
// after (client-side predicate)
filter, _ := query.Parse("priority >= 0")
issues = filterIssues(issues, func(i types.Issue) bool { return i.Priority != 2 })
Defensive patterns

Strategy: fallback

Validate before calling

func supportsNotEquals(field string) bool { return field == "status" || field == "type" } // priority does not
if op == query.OpNotEquals && field == "priority" { planClientSidePredicate() }

Try / catch

if err := e.applyComparison(comp, filter); err != nil {
    if strings.Contains(err.Error(), "priority != requires predicate filtering") {
        return queryAllThenFilter(func(i types.Issue) bool { return i.Priority != want })
    }
    return err
}

Prevention

When it happens

Trigger: Queries like `priority != 2` — any ComparisonNode with Field="priority" and Op=OpNotEquals.

Common situations: Users who just used `status != closed` (which IS supported) assuming all fields support !=; generated queries that emit != uniformly; older scripts written before this guard existed that silently mis-filtered.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/2bdc94917ef8ff34. Report an issue: GitHub.