{"record":{"id":"0d739b6cef09b625","repo":"gastownhall/beads","slug":"priority-d-matches-nothing-0d739b","errorCode":null,"errorMessage":"priority > %d matches nothing","messagePattern":"priority > (.+?) matches nothing","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/query/evaluator.go","lineNumber":253,"sourceCode":"\tcase OpEquals:\n\t\tfilter.Priority = &priority\n\tcase OpNotEquals:\n\t\t// For != we need predicate filtering\n\t\treturn fmt.Errorf(\"priority != requires predicate filtering\")\n\tcase OpLess:\n\t\t// priority < X means PriorityMax = X-1\n\t\tmax := priority - 1\n\t\tif max < 0 {\n\t\t\treturn fmt.Errorf(\"priority < %d matches nothing\", priority)\n\t\t}\n\t\tfilter.PriorityMax = &max\n\tcase OpLessEq:\n\t\tfilter.PriorityMax = &priority\n\tcase OpGreater:\n\t\t// priority > X means PriorityMin = X+1\n\t\tmin := priority + 1\n\t\tif min > 4 {\n\t\t\treturn fmt.Errorf(\"priority > %d matches nothing\", priority)\n\t\t}\n\t\tfilter.PriorityMin = &min\n\tcase OpGreaterEq:\n\t\tfilter.PriorityMin = &priority\n\t}\n\treturn nil\n}\n\nfunc (e *Evaluator) applyTypeFilter(comp *ComparisonNode, filter *types.IssueFilter) error {\n\tif comp.Op != OpEquals && comp.Op != OpNotEquals {\n\t\treturn fmt.Errorf(\"type only supports = and != operators\")\n\t}\n\tissueType := types.IssueType(strings.ToLower(comp.Value))\n\tif comp.Op == OpEquals {\n\t\tfilter.IssueType = &issueType\n\t} else {\n\t\tfilter.ExcludeTypes = append(filter.ExcludeTypes, issueType)\n\t}","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/query/evaluator.go#L235-L271","documentation":"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.","triggerScenarios":"Exactly `priority > 4`: min := priority+1 = 5 > 4 triggers the error.","commonSituations":"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.","solutions":["Remove the clause — no issue can have priority > 4.","Use `priority >= 4` if \"highest-numbered (lowest) priority\" is intended, or `priority <= 1` etc. for the high-urgency end.","Caller-side guard: skip emitting a `>` clause when the operand is >= 4."],"exampleFix":"// before (guaranteed empty)\n\"priority > 4\"\n// after\n\"priority >= 4\"  // or drop the clause","handlingStrategy":"validation","validationCode":"func emitGreaterThanPriority(x int) (string, bool) {\n    if x+1 > 4 { return \"\", false } // priority > 4 matches nothing\n    return fmt.Sprintf(\"priority > %d\", x), true\n}","typeGuard":null,"tryCatchPattern":"if err := e.applyComparison(comp, filter); err != nil {\n    if strings.Contains(err.Error(), \"matches nothing\") {\n        return nil, nil // empty result is expected\n    }\n    return err\n}","preventionTips":["Remember priorities top out at 4, so > 4 is always empty.","Guard generated clauses: skip > comparisons whose operand is >= 4.","Use >= 4 explicitly when the boundary value itself should match."],"tags":["query","priority","logic","beads"],"backgroundTag":"impossible-query-condition","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}