Skip to content

Error cheat sheet

Paste what you saw, or search a word from it. Red text is feedback, not failure — every one of these has happened to everyone on your team.

Before you search

Read the first error, go to that line number, and check the line above it too. Later errors are usually the first one echoing.

12 of 12 shown

  • ';' expected

    What causes it

    A missing semicolon.

    The fix

    Add ; at the end of the statement. Check the line above too — javac points at the line after the missing one.

  • cannot find symbol

    What causes it

    A typo, a missing import, or a variable that was never declared.

    The fix

    Read the symbol: line — that is the exact name javac could not find. Check spelling and capitals, then use Quick Fix to add the import.

    What it looks like
    cannot find symbol  symbol:   variable motorSped  location: class Main
  • incompatible types

    What causes it

    A value of one type assigned to a variable of another.

    The fix

    Match the types. "0.5" is text; 0.5 is a number. 5 / 2 is 2 because both are ints — write 5.0 / 2.

    What it looks like
    incompatible types: java.lang.String cannot be converted to double
  • missing return statement

    What causes it

    A method that promises a value has a path that returns nothing.

    The fix

    Every route through the method needs a return, including the one after the last if.

  • reached end of file while parsing

    What causes it

    A missing closing brace.

    The fix

    Count your braces, or auto-format the file (Shift+Alt+F) — badly indented code is where the missing } shows itself.

  • class X is public, should be declared in a file named X.java

    What causes it

    The class name and the file name do not match.

    The fix

    Rename one to match the other. Java is case sensitive: intake.java is not Intake.java.

    What it looks like
    class Main is public, should be declared in a file named Main.java
  • non-static method cannot be referenced from a static context

    What causes it

    A method that belongs to an object was called on the class itself.

    The fix

    Make an object first: Intake intake = new Intake(); then intake.run();. Or mark the method static if it does not need an object.

    What it looks like
    non-static method clamp(double,double,double) cannot be referenced from a static context
  • NullPointerException

    What causes it

    Using an object that was never created.

    The fix

    Find the variable named in the message and check it was given a value with new. This one happens while the code runs, not while it compiles.

    What it looks like
    Exception in thread "main" java.lang.NullPointerException
  • Simulation will not start

    What causes it

    A build error, or the firewall blocking it.

    The fix

    Read the terminal — the first red line is the real problem. If Windows asks about the firewall, allow it on private networks.

    Week 4
  • No Robot Code

    What causes it

    The code crashed while starting up on the robot.

    The fix

    Open the Driver Station console and read the stack trace. It is almost always a NullPointerException in the constructor.

    Week 7
  • Deploy cannot find the robot

    What causes it

    Wrong team number in project settings, or not connected to the robot.

    The fix

    Check the team number in the WPILib project settings, then check the radio connection and that the Driver Station shows communications.

    Week 7
  • Vendor import not found

    What causes it

    The vendor library is not installed in this project.

    The fix

    Ctrl+Shift+P, then WPILib: Manage Vendor Libraries, then install the REV or CTRE library online.

    What it looks like
    package com.revrobotics does not exist