cayleygraph/cayley · error
filters inside expand all are not supported
Error message
filters inside expand all are not supported
What it means
The expand-all wildcard field must be a bare selection: it cannot carry directive-style filter arguments (`has`) or nested sub-fields. Any filtering inside an expand-all selection is unsupported and rejected.
Source
Thrown at query/graphql/graphql.go:458
return &Query{fields: fields}, nil
}
func setToFields(set *ast.SelectionSet, labels []quad.Value) (out []field, all bool, _ error) {
if set == nil {
return
}
for _, s := range set.Selections {
switch sel := s.(type) {
case *ast.Field:
fld, err := convField(sel, labels)
if err != nil {
return nil, false, err
}
if fld.Via == quad.IRI(AnyKey) {
if len(set.Selections) != 1 {
return nil, false, fmt.Errorf("expand all cannot be used with other fields")
} else if len(fld.Has) != 0 || len(fld.Fields) != 0 {
return nil, false, fmt.Errorf("filters inside expand all are not supported")
}
return nil, true, nil
}
out = append(out, fld)
default:
return nil, false, fmt.Errorf("unknown selection type: %T", s)
}
}
return
}
func stringToVia(s string) (_ quad.IRI, rev bool) {
if len(s) > 0 && s[0] == '~' {
rev = true
s = s[1:]
}
if len(s) > 2 && s[0] == '<' && s[len(s)-1] == '>' {
s = s[1 : len(s)-1]View on GitHub (pinned to 81dcd7d73e)
Solutions
- Use `_` with no arguments and no sub-selection, then filter results client-side
- Filter by labeling the data first and querying labeled predicates explicitly
- Expand via explicit predicate names with `has` filters on named fields instead
Example fix
// before
q := "query { node { _(has: "name") } }"
// after
q := "query { node { _ } }" Defensive patterns
Strategy: validation
Validate before calling
function checkWildcardClean(sel) {
if (sel.name?.value !== '_') return;
if ((sel.arguments?.length ?? 0) > 0 || (sel.selectionSet?.selections?.length ?? 0) > 0) {
throw new Error('expand all (_) cannot have arguments or sub-selections');
}
} Type guard
const isCleanWildcard = (s) => s?.name?.value === '_' && !s.arguments?.length && !s.selectionSet;
Prevention
- Use `_` bare, with no has arguments or nested fields
- Filter expanded results client-side
- Consult docs on expand-all limitations before use
When it happens
Trigger: Writing `query { node { _(has: "name") } }` or `query { node { _ { name } } }` — convField produces a wildcard field with non-empty Has or Fields, and setToFields rejects it.
Common situations: Trying to filter which predicates are expanded; nesting fields under `_` assuming it selects sub-properties; translating SQL-ish 'select * where' intuition into GraphQL syntax.
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
- expand all is not supported at top level
- expand all cannot be used with other fields
- unexpected arguments: %v (%d)
- unexpected value type for %v: %T
- cannot unnest more than one object on %q; use (%s: 1) to for
AI-assisted analysis of cayleygraph/cayley@81dcd7d73e (2026-09-06).
Data as JSON: /api/errors/83af958fda21764d.
Report an issue: GitHub.