gastownhall/beads · error

boolean field does not support %s operator

Error message

boolean field does not support %s operator

What it means

Boolean fields only support the = and != operators in this query language. buildBoolPredicate returns this error when a successfully parsed boolean value is combined with any other operator (>, <, >=, <=, etc.), since booleans have no ordering semantics here.

Source

Thrown at internal/query/evaluator.go:1042

func (e *Evaluator) buildBoolPredicate(comp *ComparisonNode, getter func(*types.Issue) bool) (func(*types.Issue) bool, error) {
	val := strings.ToLower(comp.Value)
	var boolVal bool
	switch val {
	case "true", "yes", "1":
		boolVal = true
	case "false", "no", "0":
		boolVal = false
	default:
		return nil, fmt.Errorf("invalid boolean value: %s", comp.Value)
	}

	switch comp.Op {
	case OpEquals:
		return func(i *types.Issue) bool { return getter(i) == boolVal }, nil
	case OpNotEquals:
		return func(i *types.Issue) bool { return getter(i) != boolVal }, nil
	default:
		return nil, fmt.Errorf("boolean field does not support %s operator", comp.Op.String())
	}
}

// Evaluate is a convenience function that parses and evaluates a query string.
func Evaluate(query string) (*QueryResult, error) {
	return EvaluateAt(query, time.Now())
}

// EvaluateAt parses and evaluates a query string with a specific reference time.
func EvaluateAt(query string, now time.Time) (*QueryResult, error) {
	node, err := Parse(query)
	if err != nil {
		return nil, err
	}
	eval := NewEvaluator(now)
	return eval.Evaluate(node)
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Use = or != only: pinned = true, blocked != no.
  2. If you need graded logic, compare the numeric priority/status field instead of a boolean.
  3. For negation, prefer field != true or a NOT on the clause rather than ordering operators.
  4. Fix query builders to whitelist =/!= for boolean fields.

Example fix

// before
bd list --query "pinned > false"
// after
bd list --query "pinned = true"
Defensive patterns

Strategy: validation

Validate before calling

func checkBoolOperator(op Operator) error {
	if op != OpEquals && op != OpNotEquals {
		return fmt.Errorf("boolean fields support only = and !=, got %s", op)
	}
	return nil
}

Type guard

func isBoolEqualityQuery(op Operator) bool { return op == OpEquals || op == OpNotEquals }

Try / catch

if err != nil && strings.Contains(err.Error(), "boolean field does not support") {
	return fmt.Errorf("use = or != on boolean fields: %w", err)
}

Prevention

When it happens

Trigger: Queries like `pinned > true` or `blocked >= no` — any boolean field compared with an operator other than = or !=.

Common situations: Translating numeric comparisons (urgency > 0) into boolean fields; template-generated queries applying range operators uniformly; misunderstanding that booleans are rank-ordered.

Related errors


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