Error when deploying code

Why does this error create. It’s saying there is supposed to be a file called networktables.json that doesn’t exist, how do I remove the network table dependency thing.

Sorry couldn’t make screen shots

The message re: json is not the cause of your issue. What comes a bit later is, starting with “Unhandled exception”. See Reading Stacktraces — FIRST Robotics Competition documentation for how to read it (the link is printed in the error message as well). It appears there’s a null variable being used in line 34.

So I traced down the error to this method which has an null pointer exception.

Does null pointer exception mean I’m going outside the bounds of the array?

IndexOutOfBoundsException is what you’d get if your array was too small.

However, you can see from your stacktrace that it:

“cannot read the array length because <local2> is null.”

So, from the context here it seems that it cannot get the length of an array. There are two arrays in this function: positions, and mSwerveMods. The exact line number of the error is cut off in the stacktrace picture, but you can probably check to see which line it is and figure out which array is null.

positions is initialized in the first line of the function, so it must be that mSwerveMods is null. Since the stacktrace shows it’s being called by <init> (aka the class constructor), my guess is that the code is calling getPositions() in the constructor prior to mSwerveMods being initialized.


Ahh, I just looked over the code, and it turns out the getPositions() was being called before mSwerveMods were initialized. I wouldn’t have ever caught that without your help. Thanks! I will try deploying on Wednesday to see if it works.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.