gastownhall/beads · warning
priority < %d matches nothing
Error message
priority < %d matches nothing
What it means
The evaluator translates `priority < X` into PriorityMax = X-1. If X is 0, that bound would be -1, which no issue can have — so the evaluator short-circuits and reports that the comparison can never match anything instead of silently returning an empty result set. It's a contract check against a provably-empty query.
Source
Thrown at internal/query/evaluator.go:244
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
}
return nil
}
func (e *Evaluator) applyTypeFilter(comp *ComparisonNode, filter *types.IssueFilter) error {View on GitHub (pinned to 71377f2769)
Solutions
- Remove the clause — no issue can have priority < 0; an empty result is guaranteed.
- If "lowest priority" is intended, use `priority = 4` (or >= 3, etc.) explicitly.
- Add a caller-side guard: skip emitting a `<` clause when the operand is <= 0.
Example fix
// before (guaranteed empty) "priority < 0" // after — drop the clause, or express the intent "priority = 4"
Defensive patterns
Strategy: validation
Validate before calling
func emitLessThanPriority(x int) (string, bool) {
if x-1 < 0 { return "", false } // priority < 0 matches nothing
return fmt.Sprintf("priority < %d", x), true
} Try / catch
if err := e.applyComparison(comp, filter); err != nil {
if strings.Contains(err.Error(), "matches nothing") {
return nil, nil // empty result is the correct, expected outcome
}
return err
} Prevention
- Remember the priority scale starts at 0, so < 0 is always empty.
- Guard generated clauses: skip < comparisons whose operand is <= 0.
- Treat this error as informational — it flags a query that would return zero rows anyway.
When it happens
Trigger: Exactly `priority < 0` (or equivalent computed expressions resolving to 0): max := priority-1 = -1 < 0 triggers the error.
Common situations: Programmatic query builders computing `priority < minPriority` where minPriority is 0; user mistakes thinking priorities start at 1 when they start at 0.
Related errors
- priority > %d matches nothing
- invalid priority value: %s
- priority must be between 0 and 4
- priority != requires predicate filtering
- unknown field: %s
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/7bcfb7cfbe194c98.
Report an issue: GitHub.