{"record":{"id":"6b29be142a94e6a0","repo":"dgraph-io/dgraph","slug":"expected-found-s-6b29be","errorCode":null,"errorMessage":"expected ')', found: %s","messagePattern":"expected '\\)', found: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"chunker/rdf_parser.go","lineNumber":254,"sourceCode":"\ts := item.Val\n\n\tit.Next()\n\tif item = it.Item(); item.Typ != itemLeftRound {\n\t\treturn \"\", fmt.Errorf(\"expected '(', found: %s\", item.Val)\n\t}\n\n\tit.Next()\n\tif item = it.Item(); item.Typ != itemVarName {\n\t\treturn \"\", fmt.Errorf(\"expected variable name, found: %s\", item.Val)\n\t}\n\tif strings.TrimSpace(item.Val) == \"\" {\n\t\treturn \"\", errors.New(\"empty variable name in function call\")\n\t}\n\ts += \"(\" + item.Val + \")\"\n\n\tit.Next()\n\tif item = it.Item(); item.Typ != itemRightRound {\n\t\treturn \"\", fmt.Errorf(\"expected ')', found: %s\", item.Val)\n\t}\n\n\treturn s, nil\n}\n\nfunc parseFacetsRDF(it *lex.ItemIterator, rnq *api.NQuad) error {\n\tif !it.Next() {\n\t\treturn errors.New(\"unexpected end of facets\")\n\t}\n\titem := it.Item()\n\tif item.Typ != itemLeftRound {\n\t\treturn fmt.Errorf(\"expected '(' but found %v at facet\", item.Val)\n\t}\n\n\tfor it.Next() { // parse one key value pair\n\t\t// parse key\n\t\titem = it.Item()\n\t\tif item.Typ != itemText {","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/chunker/rdf_parser.go#L236-L272","documentation":"Error raised by the RDF parser in chunker/rdf_parser.go when a function call's closing parenthesis is missing or another token appears where ')' is expected. The unexpected token is reported via %s. Fix by correcting the function-call syntax so it is properly closed.","triggerScenarios":"ParseRDF input with an unterminated function call, e.g. 'uid(var' missing ')', or extra tokens like 'uid(var var2)' between the parentheses.","commonSituations":"Truncated lines from file cuts or network transfer; hand-edited queries that dropped the closing paren; multiple arguments typed where only one variable is allowed.","solutions":["Add the missing ')' after the variable name.","Remove any extra tokens between '(' and ')' — exactly one variable name is allowed.","Verify the line was not truncated in transit or by an editor."],"exampleFix":"// before\nParseRDF(\"<s> <p> uid(var .\")   // missing ')'\n// after\nParseRDF(\"<s> <p> uid(var) .\")","handlingStrategy":"validation","validationCode":"matched, _ := regexp.MatchString(`\\w+\\(\\s*[A-Za-z0-9_]+\\s*\\)`, fnExpr)\nif !matched { return errors.New(\"malformed function call\") }","typeGuard":null,"tryCatchPattern":"if _, err := parseFunction(it); err != nil {\n\tif strings.HasPrefix(err.Error(), \"expected ')'\") {\n\t\treturn fmt.Errorf(\"unterminated function call in RDF line: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Balance-check parentheses in generated lines before parsing.","Avoid truncation: write and transfer RDF files as whole lines.","Keep exactly one variable inside function parens."],"tags":["rdf","parsing","syntax","dgraph"],"backgroundTag":"parser-syntax-error","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}