bytebase/bytebase · error

only "creator" support "!=" operator

Error message

only "creator" support "!=" operator

What it means

Raised while translating a CEL `!=` call in the ListSavedQueries filter when the left-hand variable is anything other than `creator`. Only creator-inequality is implemented (`saved_query.creator != ?`); other fields must use `==` or `in`. The parser rejects the combination early instead of generating wrong SQL.

Source

Thrown at backend/store/saved_query.go:843

					return nil, errors.Errorf("expect string, got %T, hint: filter literals should be string", value)
				}
				if strValue == "" {
					return nil, errors.Errorf(`empty value for %q`, variable)
				}

				switch variable {
				case "title":
					if !allowTitleContains {
						return nil, errors.Errorf("unsupport variable %q", variable)
					}
					return qb.Q().Space("LOWER(saved_query.name) LIKE ? ESCAPE '\\'", containsPattern(strings.ToLower(strValue))), nil
				default:
					return nil, errors.Errorf("unsupport variable %q", variable)
				}
			case celoperators.NotEquals:
				variable, value := getVariableAndValueFromExpr(expr)
				if variable != "creator" {
					return nil, errors.Errorf(`only "creator" support "!=" operator`)
				}
				creator, ok := value.(string)
				if !ok {
					return nil, errors.Errorf("invalid creator value %v, expect a string", value)
				}
				userID, err := getUserID(creator)
				if err != nil {
					return nil, err
				}
				return qb.Q().Space("saved_query.creator != ?", userID), nil
			case celoperators.In:
				variable, value := getVariableAndValueFromExpr(expr)
				rawList, ok := value.([]any)
				if !ok {
					return nil, errors.Errorf("invalid %s value %q", variable, value)
				}
				if len(rawList) == 0 {
					return nil, errors.Errorf("empty %s filter", variable)

View on GitHub (pinned to 1870550677)

Solutions

  1. Restrict `!=` usage to `creator`, e.g. `creator != "users/alice"`.
  2. Express other exclusions via `in` on `name`, or drop the clause and filter results client-side.
  3. To support `!=` on another field, extend the celoperators.NotEquals branch in backend/store/saved_query.go.

Example fix

// before
const filter = 'folder != "archive"';
// after
const filter = 'folder == "archive"'; // negate in app code if exclusion is needed
Defensive patterns

Strategy: validation

Validate before calling

function assertNotEqualsTarget(field) {
  if (field !== 'creator') {
    throw new Error(`!= only supported on creator, got '${field}'`);
  }
}

Try / catch

try {
  return await listSavedQueries({ filter });
} catch (e) {
  if (String(e).includes('only "creator" support')) {
    // drop the negated clause and filter client-side
  }
}

Prevention

When it happens

Trigger: Filters like `title != "x"`, `folder != "a"`, or `name != "b"` passed to ListSavedQueries.

Common situations: Building negated filters generically from UI toggles ('exclude value X') on fields the backend does not support negation for.

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


AI-assisted analysis of bytebase/bytebase@1870550677 (2026-09-06). Data as JSON: /api/errors/180c51b8caffd197. Report an issue: GitHub.