{"record":{"id":"6546b8a46bc12093","repo":"gastownhall/beads","slug":"boolean-field-does-not-support-s-operator","errorCode":null,"errorMessage":"boolean field does not support %s operator","messagePattern":"boolean field does not support (.+?) operator","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/query/evaluator.go","lineNumber":1042,"sourceCode":"func (e *Evaluator) buildBoolPredicate(comp *ComparisonNode, getter func(*types.Issue) bool) (func(*types.Issue) bool, error) {\n\tval := strings.ToLower(comp.Value)\n\tvar boolVal bool\n\tswitch val {\n\tcase \"true\", \"yes\", \"1\":\n\t\tboolVal = true\n\tcase \"false\", \"no\", \"0\":\n\t\tboolVal = false\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid boolean value: %s\", comp.Value)\n\t}\n\n\tswitch comp.Op {\n\tcase OpEquals:\n\t\treturn func(i *types.Issue) bool { return getter(i) == boolVal }, nil\n\tcase OpNotEquals:\n\t\treturn func(i *types.Issue) bool { return getter(i) != boolVal }, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"boolean field does not support %s operator\", comp.Op.String())\n\t}\n}\n\n// Evaluate is a convenience function that parses and evaluates a query string.\nfunc Evaluate(query string) (*QueryResult, error) {\n\treturn EvaluateAt(query, time.Now())\n}\n\n// EvaluateAt parses and evaluates a query string with a specific reference time.\nfunc EvaluateAt(query string, now time.Time) (*QueryResult, error) {\n\tnode, err := Parse(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\teval := NewEvaluator(now)\n\treturn eval.Evaluate(node)\n}\n","sourceCodeStart":1024,"sourceCodeEnd":1060,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/query/evaluator.go#L1024-L1060","documentation":"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.","triggerScenarios":"Queries like `pinned > true` or `blocked >= no` — any boolean field compared with an operator other than = or !=.","commonSituations":"Translating numeric comparisons (urgency > 0) into boolean fields; template-generated queries applying range operators uniformly; misunderstanding that booleans are rank-ordered.","solutions":["Use = or != only: pinned = true, blocked != no.","If you need graded logic, compare the numeric priority/status field instead of a boolean.","For negation, prefer field != true or a NOT on the clause rather than ordering operators.","Fix query builders to whitelist =/!= for boolean fields."],"exampleFix":"// before\nbd list --query \"pinned > false\"\n// after\nbd list --query \"pinned = true\"","handlingStrategy":"validation","validationCode":"func checkBoolOperator(op Operator) error {\n\tif op != OpEquals && op != OpNotEquals {\n\t\treturn fmt.Errorf(\"boolean fields support only = and !=, got %s\", op)\n\t}\n\treturn nil\n}","typeGuard":"func isBoolEqualityQuery(op Operator) bool { return op == OpEquals || op == OpNotEquals }","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"boolean field does not support\") {\n\treturn fmt.Errorf(\"use = or != on boolean fields: %w\", err)\n}","preventionTips":["Never apply ordering operators to boolean fields","Express graded conditions with numeric fields (priority) instead","Whitelist =/!= for boolean fields in query generators","Cover boolean operators in query-syntax unit tests"],"tags":["query","operators","boolean"],"backgroundTag":"unsupported-operator-for-field","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}