Unmatched backtick in pkl repl causes ArrayIndexOutOfBoundsExpression in the lexer #342

Closed
opened 2025-12-30 01:23:41 +01:00 by adam · 1 comment
Owner

Originally created by @sin-ack on GitHub (Aug 20, 2025).

Reproduced in Pkl 0.30.0-dev+3f2f0c3a.

» pkl repl
Welcome to Pkl 0.30.0-dev+3f2f0c3a.
Type an expression to have it evaluated.
Type :help or :examples for more information.

pkl0> `
An unexpected error has occurred. Would you mind filing a bug report?

java.lang.ArrayIndexOutOfBoundsException: Index -2147483648 out of bounds for length 1
        at org.pkl.parser.Lexer.nextChar(Lexer.java:679)
        at org.pkl.parser.Lexer.lexQuotedIdentifier(Lexer.java:493)
        at org.pkl.parser.Lexer.nextDefault(Lexer.java:220)
        at org.pkl.parser.Lexer.next(Lexer.java:70)
        at org.pkl.parser.Parser.forceNext(Parser.java:1790)
        at org.pkl.parser.Parser.init(Parser.java:106)
        at org.pkl.parser.Parser.parseReplInput(Parser.java:165)
        at org.pkl.core.repl.ReplServer.evaluate(ReplServer.java:184)
        at org.pkl.core.repl.ReplServer.handleEval(ReplServer.java:161)
        at org.pkl.core.repl.ReplServer.handleRequest(ReplServer.java:126)
        at org.pkl.cli.repl.Repl.handleEvalRequest(Repl.kt:176)
        at org.pkl.cli.repl.Repl.evaluate(Repl.kt:160)
        at org.pkl.cli.repl.Repl.run(Repl.kt:95)
        at org.pkl.cli.CliRepl.doRun(CliRepl.kt:72)
        at org.pkl.commons.cli.CliCommand.run(CliCommand.kt:46)
        at org.pkl.cli.commands.ReplCommand.run(ReplCommand.kt:31)
        at com.github.ajalt.clikt.core.CoreCliktCommandKt.parse(CoreCliktCommand.kt:107)
        at com.github.ajalt.clikt.core.CoreCliktCommandKt.main(CoreCliktCommand.kt:78)
        at com.github.ajalt.clikt.core.CoreCliktCommandKt.main(CoreCliktCommand.kt:90)
        at org.pkl.cli.Main.main$lambda$0(Main.kt:26)
        at org.pkl.commons.cli.CliMainKt.cliMain(CliMain.kt:33)
        at org.pkl.cli.Main.main(Main.kt:26)

This curiously does not happen with regular pkl eval, only on the REPL.

Originally created by @sin-ack on GitHub (Aug 20, 2025). Reproduced in Pkl 0.30.0-dev+3f2f0c3a. ``` » pkl repl Welcome to Pkl 0.30.0-dev+3f2f0c3a. Type an expression to have it evaluated. Type :help or :examples for more information. pkl0> ` An unexpected error has occurred. Would you mind filing a bug report? java.lang.ArrayIndexOutOfBoundsException: Index -2147483648 out of bounds for length 1 at org.pkl.parser.Lexer.nextChar(Lexer.java:679) at org.pkl.parser.Lexer.lexQuotedIdentifier(Lexer.java:493) at org.pkl.parser.Lexer.nextDefault(Lexer.java:220) at org.pkl.parser.Lexer.next(Lexer.java:70) at org.pkl.parser.Parser.forceNext(Parser.java:1790) at org.pkl.parser.Parser.init(Parser.java:106) at org.pkl.parser.Parser.parseReplInput(Parser.java:165) at org.pkl.core.repl.ReplServer.evaluate(ReplServer.java:184) at org.pkl.core.repl.ReplServer.handleEval(ReplServer.java:161) at org.pkl.core.repl.ReplServer.handleRequest(ReplServer.java:126) at org.pkl.cli.repl.Repl.handleEvalRequest(Repl.kt:176) at org.pkl.cli.repl.Repl.evaluate(Repl.kt:160) at org.pkl.cli.repl.Repl.run(Repl.kt:95) at org.pkl.cli.CliRepl.doRun(CliRepl.kt:72) at org.pkl.commons.cli.CliCommand.run(CliCommand.kt:46) at org.pkl.cli.commands.ReplCommand.run(ReplCommand.kt:31) at com.github.ajalt.clikt.core.CoreCliktCommandKt.parse(CoreCliktCommand.kt:107) at com.github.ajalt.clikt.core.CoreCliktCommandKt.main(CoreCliktCommand.kt:78) at com.github.ajalt.clikt.core.CoreCliktCommandKt.main(CoreCliktCommand.kt:90) at org.pkl.cli.Main.main$lambda$0(Main.kt:26) at org.pkl.commons.cli.CliMainKt.cliMain(CliMain.kt:33) at org.pkl.cli.Main.main(Main.kt:26) ``` This curiously does not happen with regular `pkl eval`, only on the REPL.
adam closed this issue 2025-12-30 01:23:41 +01:00
Author
Owner

@bioball commented on GitHub (Aug 21, 2025):

Can reproduce, thanks for the bug report!

@bioball commented on GitHub (Aug 21, 2025): Can reproduce, thanks for the bug report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#342