gastownhall/beads · warning

priority > %d matches nothing

Error message

priority > %d matches nothing

What it means

Symmetric to the < case: `priority > X` becomes PriorityMin = X+1, and if X is 4 the min would be 5, which is outside the valid 0–4 priority range, so the evaluator rejects the comparison as unmatchable. This prevents constructing a filter whose lower bound exceeds the priority enum.

Source

Thrown at internal/query/evaluator.go:253

	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 {
	if comp.Op != OpEquals && comp.Op != OpNotEquals {
		return fmt.Errorf("type only supports = and != operators")
	}
	issueType := types.IssueType(strings.ToLower(comp.Value))
	if comp.Op == OpEquals {
		filter.IssueType = &issueType
	} else {
		filter.ExcludeTypes = append(filter.ExcludeTypes, issueType)
	}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Remove the clause — no issue can have priority > 4.
  2. Use `priority >= 4` if "highest-numbered (lowest) priority" is intended, or `priority <= 1` etc. for the high-urgency end.
  3. Caller-side guard: skip emitting a `>` clause when the operand is >= 4.

Example fix

// before (guaranteed empty)
"priority > 4"
// after
"priority >= 4"  // or drop the clause
Defensive patterns

Strategy: validation

Validate before calling

func emitGreaterThanPriority(x int) (string, bool) {
    if x+1 > 4 { return "", false } // priority > 4 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 expected
    }
    return err
}

Prevention

When it happens

Trigger: Exactly `priority > 4`: min := priority+1 = 5 > 4 triggers the error.

Common situations: Users assuming priorities go above 4 (e.g. P5 exists); query builders emitting `priority > maxPriority` where maxPriority defaults to 4; ported queries from systems with wider ranges.

Related errors


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