pocketbase/pocketbase · error

unknown modifier in %q

Error message

unknown modifier in %q

What it means

The field/modifier parser split the token on ':' and the modifier part is not one of the five known modifiers (isset, each, length, lower, changed). The message echoes the full combined token. This is a syntax error in a filter/sort string, returned before any database work happens.

Source

Thrown at core/record_field_resolver.go:591

func splitModifier(combined string) (string, string, error) {
	parts := strings.Split(combined, ":")

	if len(parts) != 2 {
		return combined, "", nil
	}

	// validate modifier
	switch parts[1] {
	case issetModifier,
		eachModifier,
		lengthModifier,
		lowerModifier,
		changedModifier:
		return parts[0], parts[1], nil
	}

	return "", "", fmt.Errorf("unknown modifier in %q", combined)
}

View on GitHub (pinned to 5d217ddb50)

Solutions

  1. Locate the token named in the message and correct the modifier to one of: :isset, :each, :length, :lower, :changed.
  2. If you wanted an uppercase comparison, invert it: compare LOWER(field) via field:lower against an already-lowercased value.
  3. If the colon is accidental (e.g. time value '10:30' inside a field token), quote the value properly so it is not parsed as a modifier.

Example fix

// before
filter := "title:upper = 'ABC'"
// after
filter := "title:lower = 'abc'"
Defensive patterns

Strategy: validation

Validate before calling

var knownModifiers = map[string]bool{":isset": true, ":each": true, ":length": true, ":lower": true, ":changed": true}
func validateModifiers(filter string) error {
    for _, tok := range strings.FieldsFunc(filter, func(r rune) bool { return r == ' ' || r == '(' || r == ')' }) {
        if i := strings.Index(tok, ":"); i > 0 && strings.ContainsAny(tok[i:], "abcdefghijklmnopqrstuvwxyz") {
            mod := tok[i:]
            if !knownModifiers[mod] {
                return fmt.Errorf("unknown modifier %q in token %q", mod, tok)
            }
        }
    }
    return nil
}

Prevention

When it happens

Trigger: Filter containing a token like "title:upper", "date:format", or a URL that turned '=' into a colon; also plain typos such as "field: lengh". Anything after ':' that is not in the allow-list triggers it.

Common situations: Assuming a modifier exists that doesn't (e.g. :upper, :trim); copy-pasting from docs of a different version; client-side filter builders that join field and operator with ':' by mistake.

Related errors


AI-assisted analysis of pocketbase/pocketbase@5d217ddb50 (2026-08-15). Data as JSON: /api/errors/979f517275e47157. Report an issue: GitHub.