dgraph-io/dgraph · error
while processing '%s', brackets are not closed properly
Error message
while processing '%s', brackets are not closed properly
What it means
GetFullTextTokens tokenizes one value with the FullTextTokenizer for the given language. Like GetTokens, it requires exactly one argument in funcArgs; more or fewer is an API misuse and returns this error.
Source
Thrown at chunker/json_parser.go:233
nq.ObjectValue = &api.Value{Val: &api.Value_IntVal{IntVal: v}}
case string:
// Default value is considered as S P * deletion.
if v == "" && op == DeleteNquads {
nq.ObjectValue = &api.Value{Val: &api.Value_DefaultVal{DefaultVal: x.Star}}
return nil
}
if vf, err := types.ParseVFloat(v); err == nil && len(vf) != 0 {
nq.ObjectValue = &api.Value{Val: &api.Value_Vfloat32Val{Vfloat32Val: types.FloatArrayAsBytes(vf)}}
return nil
}
// Handle the uid function in upsert block
s := stripSpaces(v)
if strings.HasPrefix(s, "uid(") || strings.HasPrefix(s, "val(") {
if !strings.HasSuffix(s, ")") {
return fmt.Errorf("while processing '%s', brackets are not closed properly", s)
}
nq.ObjectId = s
return nil
}
// In RDF, we assume everything is default (types.DefaultID), but in JSON we assume string
// (StringID). But this value will be checked against the schema so we don't overshadow a
// password value (types.PasswordID) - Issue#2623
nq.ObjectValue = &api.Value{Val: &api.Value_StrVal{StrVal: v}}
case float64:
if v == 0 && op == DeleteNquads {
nq.ObjectValue = &api.Value{Val: &api.Value_DefaultVal{DefaultVal: x.Star}}
return nil
}
nq.ObjectValue = &api.Value{Val: &api.Value_DoubleVal{DoubleVal: v}}
case bool:View on GitHub (pinned to 759e242be6)
Solutions
- Join multiple values into one string and pass a single-element slice: tok.GetFullTextTokens([]string{text}, lang).
- Validate len(funcArgs)==1 before calling.
- Fix the query parser to forward only one value argument for full-text functions.
Example fix
// before
toks, err := tok.GetFullTextTokens([]string{"alpha", "beta"}, "en")
// after
toks, err := tok.GetFullTextTokens([]string{"alpha beta"}, "en") Defensive patterns
Strategy: validation
Validate before calling
if len(funcArgs) != 1 {
return fmt.Errorf("GetFullTextTokens expects exactly 1 argument, got %d", len(funcArgs))
} Try / catch
tokens, err := tok.GetFullTextTokens(funcArgs, lang)
if err != nil && strings.Contains(err.Error(), "Function requires 1 arguments") {
return nil, fmt.Errorf("full-text functions accept a single text value; got %d", len(funcArgs))
} Prevention
- Join multiple text values into one string before full-text tokenization.
- Enforce single-argument arity in the query function parser for alloftext/anyoftext.
- Test full-text paths with both empty and multi-value argument slices.
When it happens
Trigger: Calling tok.GetFullTextTokens([]string{}, "en") or tok.GetFullTextTokens([]string{"a", "b"}, "en") — any slice whose length is not 1. Reached via full-text query handling and tests (getStringTokens, uidsForMatch paths).
Common situations: Full-text search functions (alloftext/anyoftext) receiving multiple values from parsed query args; splitting text into multiple args instead of one combined string.
Related errors
- illegal rune found "%c", expecting {
- Malformed JSON
- UID must be present and non-zero while deleting edges
- facet value can only be string/number/bool
- facets format should be of type map for scalarlist predicate
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/dba2f14326009562.
Report an issue: GitHub.