typedb / typedb-console

TypeDB Console: CLI for TypeDB and TypeDB Cluster
https://typedb.com
Mozilla Public License 2.0
7 stars 17 forks source link

schema write crashing console when last definition in file dose not end with a semicolon #149

Open JRWest2000 opened 3 years ago

JRWest2000 commented 3 years ago

running GRAKN 2.0.2 on windows 10

Not only dose it crash the transaction and the GRAKN Console and kick you all the way back to the windows console it dose not give a meaningful error message so I was three days trying to debug the problem. I would expect that most users would not even consider that the crash could be caused by a syntax error since that syntax errors any ware except the last definition throw proper error messages.

The error message read as follows

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 64 out of bounds for length 64 at java.base/java.util.Arrays$ArrayList.get(Arrays.java:4164) at graql.lang.parser.ErrorListener.syntaxError(ErrorListener.java:65) at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41) at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544) at org.antlr.v4.runtime.DefaultErrorStrategy.reportInputMismatch(DefaultErrorStrategy.java:327) at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:139) at graql.grammar.GraqlParser.eof_queries(GraqlParser.java:272) at graql.lang.parser.Parser.parse(Parser.java:137) at graql.lang.parser.Parser.parseQueriesEOF(Parser.java:152) at graql.lang.Graql.parseQueries(Graql.java:67) at grakn.console.GraknConsole.runQuery(GraknConsole.java:394) at grakn.console.GraknConsole.runSource(GraknConsole.java:384) at grakn.console.GraknConsole.runTransactionRepl(GraknConsole.java:293) at grakn.console.GraknConsole.runRepl(GraknConsole.java:254) at grakn.console.GraknConsole.runInteractive(GraknConsole.java:209) at grakn.console.GraknConsole.main(GraknConsole.java:465)

flyingsilverfin commented 3 years ago

Hi - this is definitely something we'd like to improve. Can you provide the input you entered to trigger the error please?

Thanks!

JRWest2000 commented 3 years ago

@flyingsilverfin create an empty database use your schema.gql file or any schema file take the last ; of the last item and then do a transaction [database] schema write command followed by a source [filepath] command. note both files I tried ended with a rule definition