bytebase/bytebase · error
only "name" and "email" support %q operator, but found %q
Error message
only "name" and "email" support %q operator, but found %q
What it means
The contains operator in the account filter is only implemented for the name and email columns; using it on any other variable (state, project, or an unsupported field) is rejected with this error. This is a deliberate whitelist, not a CEL limitation.
Source
Thrown at backend/store/account_filter.go:107
qq, err := getFilter(arg)
if err != nil {
return nil, err
}
q.And("?", qq)
}
return qb.Q().Space("(?)", q), nil
case celoperators.Equals:
variable, value := getVariableAndValueFromExpr(expr)
return parseToSQL(variable, value)
case celoverloads.Contains:
variable := expr.AsCall().Target().AsIdent()
args := expr.AsCall().Args()
if len(args) != 1 {
return nil, errors.Errorf(`invalid args for %q`, variable)
}
value := args[0].AsLiteral().Value()
if variable != "name" && variable != "email" {
return nil, errors.Errorf(`only "name" and "email" support %q operator, but found %q`, celoverloads.Contains, variable)
}
strValue, ok := value.(string)
if !ok {
return nil, errors.Errorf("expect string, got %T, hint: filter literals should be string", value)
}
return qb.Q().Space("LOWER("+variable+") LIKE ? ESCAPE '\\'", containsPattern(strings.ToLower(strValue))), nil
default:
return nil, errors.Errorf("unexpected function %v", functionName)
}
default:
return nil, errors.Errorf("unexpected expr kind %v", expr.Kind())
}
}
q, err := getFilter(ast.NativeRep().Expr())
if err != nil {
return nil, err
}View on GitHub (pinned to 1870550677)
Solutions
- Restrict contains to name or email: `name.contains("x")` / `email.contains("@corp")`
- Use exact equality for state and project: `state == "ACTIVE"`, `project == "projects/123"`
- Implement additional contains support in account_filter.go if substring matching on other fields is genuinely needed
Example fix
// before filter = "state.contains(\"ACT\")" // after filter = "state == \"ACTIVE\""
Defensive patterns
Strategy: validation
Validate before calling
var containsAllowed = map[string]bool{"name":true,"email":true}
if op == "contains" && !containsAllowed[field] {
return fmt.Errorf("contains only supported on name and email, not %q", field)
} Try / catch
if _, err := store.GetAccountListFilter(filter); err != nil {
return status.Errorf(codes.InvalidArgument, "bad contains usage: %v", err)
} Prevention
- Apply contains only to name and email
- Use == for state and project
- Check the supported-operator whitelist before composing filters
When it happens
Trigger: Filters like `state.contains("ACT")` or `project.contains("123")` on the account list API.
Common situations: Assuming contains works uniformly across all filter fields (AIP-160 allows it broadly), or trying substring matching on state/project where only exact equality is supported.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- unsupported operator: %s (only '==' is supported)
- unsupported variable %q for "in" operator
- unsupported function %v
- unexpected function %v
- ">=" and "<=" are only supported for "create_time"
AI-assisted analysis of bytebase/bytebase@1870550677 (2026-09-06).
Data as JSON: /api/errors/7eadfc88d7a18864.
Report an issue: GitHub.