resy-booking-bot icon indicating copy to clipboard operation
resy-booking-bot copied to clipboard

Bot giving error: bad constant pool index: 0 at pos: 48461... [ADVICE ON HOW TO FIX]

Open kevinzhao07 opened this issue 1 year ago • 2 comments

When first setting up the bot to run using sbt, I encountered this error when running sbt. I was able to fix the error but this is for anyone who may be facing a similar issue.

  1. Make sure you have Java JDK Installed. I am running openjdk 21.0.2
  2. Make sure you have Scala installed, by running brew install coursier/formulas/coursier && cs setup (for MAC). I am running 3.3.1
  3. Make sure you have sbt installed, by running brew install sbt. I am running 1.9.8

You should be able to find version by running: java --version, scala --version, sbt --version

I am doing this in 2024. The issue comes from the build.properties file in resy-booking-bot/project/build.properties. The sbt.version field is hardcoded to 1.7.1, which is a older legacy version that may not work with the latest version of Java JDK. Replace this value with your current sbt version.

EDIT: With doing this, you will also have to change the scalaVersion found in resy-booking-bot/build.sbt to one that is compatible with the sbt version. I am using 21.0.2, so changing this value to 2.13.11 works for me. I looked it up online and anything after 2.13.11 works well with 21.0.2 version of JDK.

kevinzhao07 avatar Feb 13 '24 05:02 kevinzhao07

If you want to avoid installing cs, you can use sbt to 1.9.5, scala 2.13.12 and keep openjdk at 21.0.2 (or lower). Changes to the build.properties still required.

buildgreatthings avatar Feb 13 '24 06:02 buildgreatthings

For those curious on exact steps to get the right versions on a mac you can do the following

install sdkman via https://sdkman.io/install

curl -s "https://get.sdkman.io" | bash

can run the below in same terminal or open a new one

source "$HOME/.sdkman/bin/sdkman-init.sh"

Install java/jdk via sdkman (I'm using 21.0.3 alright, but as mentioned above 21.0.2 works as we ll)

sdk install java 21.0.3

Install scala

sdk install scala 2.13.2

Install sbt

sdk install sbt 1.9.5

Update this line here https://github.com/Alkaar/resy-booking-bot/blob/df91adc712e59284bf83f5bccdd73d3e84e4a31a/build.sbt#L3 to the scala version (2.13.2)

Update this line here to the sbt version(1.9.5) https://github.com/Alkaar/resy-booking-bot/blob/df91adc712e59284bf83f5bccdd73d3e84e4a31a/project/build.properties#L1

Run sbt in project root directory, followed by a run once in sbt prompt and should see it download dependecnies and run the service/daemon with an output indicating success

jrusso1020 avatar Apr 24 '24 02:04 jrusso1020