{"record":{"id":"9060497f9e253edd","repo":"cayleygraph/cayley","slug":"errparsemore","errorCode":"ErrParseMore","errorMessage":"query: more input required","messagePattern":"query: more input required","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"info","filePath":"query/session.go","lineNumber":27,"sourceCode":"// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Package query defines the graph session interface general to all query languages.\npackage query\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/cayleygraph/cayley/graph\"\n)\n\nvar ErrParseMore = errors.New(\"query: more input required\")\n\ntype ErrUnsupportedCollation struct {\n\tCollation Collation\n}\n\nfunc (e *ErrUnsupportedCollation) Error() string {\n\treturn fmt.Sprintf(\"unsupported collation: %v\", e.Collation)\n}\n\n// Iterator for query results.\ntype Iterator interface {\n\t// Next advances the iterator to the next value, which will then be available through\n\t// the Result method. It returns false if no further advancement is possible, or if an\n\t// error was encountered during iteration.  Err should be consulted to distinguish\n\t// between the two cases.\n\tNext(ctx context.Context) bool\n\t// Results returns the current result. The type depends on the collation mode of the query.\n\tResult() interface{}","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/cayleygraph/cayley/blob/81dcd7d73e45136bc0d01802a8ba4685d8a533eb/query/session.go#L9-L45","documentation":"ErrParseMore is a sentinel error returned by REPL-oriented parsers (query.Repl, query.Parse) when the submitted input is a syntactically incomplete prefix of a valid query — e.g. unbalanced opening parentheses. It is not a failure; it signals that the caller should collect more input and re-submit the accumulated buffer.","triggerScenarios":"Submitting an incomplete s-expression to a session, such as '(g.V' without the closing parenthesis, via session.Parse or in a REPL loop using session.Execute/Run.","commonSituations":"Multi-line REPL entry where the user is still typing; programmatic line-by-line feeding of queries; trimmed input accidentally dropping a closing paren.","solutions":["Continue reading input (REPLs at internal/repl/repl.go do exactly this) and concatenate until the parse succeeds.","Check parentheses/quote balance in the input before sending.","If input is supposed to be complete, inspect for a stray unclosed '(' or an unterminated string literal."],"exampleFix":"// before\nerr := session.Execute(ctx, \"(g.V\")\n// after\nbuf := \"(g.V\"\nif _, err := ses.Parse(ctx, buf); err == query.ErrParseMore {\n    buf += readMoreLine() // keep collecting\n} else if err != nil {\n    return err\n}","handlingStrategy":"type-guard","validationCode":"if strings.Count(input, \"(\") != strings.Count(input, \")\") {\n    // input incomplete; keep buffering\n}","typeGuard":"func isParseMore(err error) bool { return err == query.ErrParseMore }","tryCatchPattern":"_, err := ses.Parse(ctx, buf)\nif errors.Is(err, query.ErrParseMore) {\n    buf += nextLine() // collect more input, retry\n    continue\n} else if err != nil {\n    return err\n}","preventionTips":["Buffer REPL input until Parse succeeds","Check paren balance before sending complete queries","Never treat ErrParseMore as a fatal error"],"tags":["go","parser","repl","incomplete-input"],"backgroundTag":"incomplete-query-input","analyzedSha":"81dcd7d73e45136bc0d01802a8ba4685d8a533eb","analyzedAt":"2026-09-06T06:14:12.358Z","contentChangedAt":"2026-09-06T06:14:12.358Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}