{"record":{"id":"7d4215e7aab2986c","repo":"gastownhall/beads","slug":"not-not-supported-for-field-s-in-filter-mode","errorCode":null,"errorMessage":"NOT not supported for field %s in filter mode","messagePattern":"NOT not supported for field (.+?) in filter mode","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/query/evaluator.go","lineNumber":605,"sourceCode":"\t}\n\n\tswitch comp.Field {\n\tcase \"status\":\n\t\tif comp.Op != OpEquals {\n\t\t\treturn fmt.Errorf(\"NOT status only supports = operator\")\n\t\t}\n\t\tstatus := types.Status(strings.ToLower(comp.Value))\n\t\tfilter.ExcludeStatus = append(filter.ExcludeStatus, status)\n\t\treturn nil\n\tcase \"type\":\n\t\tif comp.Op != OpEquals {\n\t\t\treturn fmt.Errorf(\"NOT type only supports = operator\")\n\t\t}\n\t\tissueType := types.IssueType(strings.ToLower(comp.Value))\n\t\tfilter.ExcludeTypes = append(filter.ExcludeTypes, issueType)\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"NOT not supported for field %s in filter mode\", comp.Field)\n\t}\n}\n\n// parseTimeValue parses a time value from a comparison node.\n// Supports duration values (7d, 24h) which are interpreted as \"now - duration\".\nfunc (e *Evaluator) parseTimeValue(comp *ComparisonNode) (time.Time, error) {\n\tif comp.ValueType == TokenDuration {\n\t\t// Duration values like 7d mean \"7 days ago\" for < comparisons\n\t\t// and \"within the last 7 days\" for > comparisons\n\t\t// We parse as relative to now, going backwards\n\t\treturn e.parseDurationAgo(comp.Value)\n\t}\n\t// Otherwise use the standard time parser\n\treturn timeparsing.ParseRelativeTime(comp.Value, e.now)\n}\n\n// parseDurationAgo parses a duration and returns now - duration.\nfunc (e *Evaluator) parseDurationAgo(s string) (time.Time, error) {","sourceCodeStart":587,"sourceCodeEnd":623,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/query/evaluator.go#L587-L623","documentation":"applyNot only supports NOT over the fields status and type in filter mode; any other field falls into the default case and raises this formatted error naming the field. Exclusion lists exist only for status and types, so NOT over priority, assignee, labels, metadata, etc. cannot be expressed as a filter.","triggerScenarios":"Queries like `NOT priority=1`, `NOT assignee=alice`, or `NOT has_metadata_key=team` reaching applyNot's default branch from buildFilter or extractBaseFilters.","commonSituations":"Generalizing from 'NOT status works' to all fields; trying to exclude label/metadata values via NOT; older scripts written before metadata fields existed.","solutions":["Rewrite without NOT: use the field's positive operators, e.g. `priority!=1` if the field supports != directly","For metadata/labels exclusions, filter results after the query in a script","For status/type exclusions keep `NOT status=x` / `NOT type=x` forms which are supported","Consider running two queries (with and without the value) and computing the difference client-side"],"exampleFix":"// before\nbd list 'NOT priority=1'\n// after\nbd list 'priority!=1'  # use the field's own operators, not NOT, for non-status/type fields","handlingStrategy":"validation","validationCode":"var notSupportedFields = map[string]bool{\"status\": true, \"type\": true}\nif negated && !notSupportedFields[field] {\n    return fmt.Errorf(\"field %s cannot be used with NOT; use its own operators\", field)\n}","typeGuard":"func notAllowedFor(field string) bool {\n    return field != \"status\" && field != \"type\"\n}","tryCatchPattern":null,"preventionTips":["Restrict NOT to status and type fields","For other fields use their native operators (e.g. priority!=1)","Filter exclusions for labels/metadata/assignee client-side","Check the query reference before adding NOT to a new field"],"tags":["query","not-operator","unsupported-field"],"backgroundTag":"query-operator-not-supported","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}