nedpals / errgoengine Goto Github PK
View Code? Open in Web Editor NEWContextualized programming error analysis translation engine
License: MIT License
Contextualized programming error analysis translation engine
License: MIT License
Name | Type | Code | Language |
---|---|---|---|
java.lang.ArrayStoreException | Runtime Exception | java.lang.ArrayStoreError | Java |
An attempt to store an object of an incompatible type in an array.
Add code here
Add message here
Name | Type | Code | Language |
---|---|---|---|
NoClassDefError | Runtime Exception | java.lang.NoClassDefError | Java |
The Java Virtual Machine (JVM) cannot find the definition of a class at runtime.
// MyClass.java
public class MyClass {
public static void main(String[] args) {
// Attempting to create an instance of a non-existing class
NonExistingClass obj = new NonExistingClass();
}
}
template: "Java.NoClassDefError"
---
MyClass.java:5: error: cannot find symbol
NonExistingClass obj = new NonExistingClass();
^
symbol: class NonExistingClass
location: class MyClass
1 error
Name | Type | Code | Language |
---|---|---|---|
Identifier expected | Compile-time Error | java.lang.IdentifierExpectedError | Java |
An identifier (e.g., variable name) was expected at a specific location in the code.
public class MyClass {
String input = "";
input.equals("");
}
MyClass.java:3: error: <identifier> expected
input.equals("");
^
MyClass.java:3: error: illegal start of type
input.equals("");
^
2 errors
Name | Type | Code | Language |
---|---|---|---|
expected | Compile-time Error | java.lang.CharacterExpectedError | Java |
A specific character was expected at a particular location in the code.
public class Main {
public static void main(String[] args) {
if (1 > 0 then {
System.out.println("Condition is true.");
}
}
}
public class Main {
public static void main(String[] args) {
if (1 > 0 then {
System.out.println("Condition is true.");
}
}
}
Name | Type | Code | Language |
---|---|---|---|
... expected | Compile-time Error | java.lang.ExpectedError | Java |
An expected token, character, or syntax was missing in the code.
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!" // Error: Expected ';'
}
}
Main.java:3: error: ')' or ',' expected
System.out.println("Hello, World!" // Error: Expected ';'
^
1 error
Name | Type | Code | Language |
---|---|---|---|
Unreachable statement | Compile-time Error | java.lang.UnreachableStatementError | Java |
A statement in the code is not reachable due to the existing flow of the program.
Add code here
Add message here
Name | Type | Code | Language |
---|---|---|---|
Missing return statement/value | Compile-time Error | java.MissingReturnError | Java |
A method requires a return statement or value that is missing in the code.
// MissingReturn.java
public class MissingReturn {
public int addNumbers(int a, int b) {
// Missing return statement
}
public static void main(String[] args) {
MissingReturn calculator = new MissingReturn();
int result = calculator.addNumbers(5, 7);
System.out.println("Result: " + result);
}
}
MissingReturn.java:4: error: missing return statement
}
^
1 error
Name | Type | Code | Language |
---|---|---|---|
NullPointerException | Runtime Exception | java.lang.NullPointerException | Java |
An attempt to access an object reference that is null.
public class ShouldBeNull {
public static void main(String args[]) {
String test = null;
System.out.println(test.toUpperCase());
}
}
Exception in thread "main" java.lang.NullPointerException
at ShouldBeNull.main(ShouldBeNull.java:4)
Name | Type | Code | Language |
---|---|---|---|
Missing []/{} in array | Compile-time Error | java.lang.MissingArrayBracketsError | Java |
The array declaration is missing opening or closing brackets ([]) or curly braces ({})
public class MissingArrayBracketsExample {
public static void main(String[] args) {
// Missing closing bracket in the array declaration
int[] numbers = {1, 2, 3;
for (int num : numbers) {
System.out.println(num);
}
}
}
MissingArrayBracketsExample.java:4: error: '}' expected
int[] numbers = {1, 2, 3;
^
1 error
Name | Type | Code | Language |
---|---|---|---|
Operator ... cannot be applied to ... | Compile-time Error | java.lang.OperatorCannotBeAppliedError | Java |
The specified operator cannot be used with the given types or values.
// OperatorCannotBeApplied.java
public class OperatorCannotBeApplied {
public static void main(String[] args) {
String text = "Hello";
int number = 5;
// Operator '<' cannot be applied to String and int
if (text < number) {}
}
}
error: bad operand types for binary operator '<'
if (text < number) {}
^
first type: String
second type: int
1 error
Name | Type | Code | Language |
---|---|---|---|
Cannot find symbol | Compile-time Error | java.lang.SymbolNotFoundError | Java |
The compiler cannot find a referenced symbol (variable, method, class, etc.) in the code.
public class Program {
public static void main(String[] args) {
System.out.println(a);
}
}
Program.java:3: error: cannot find symbol
System.out.println(a);
^
symbol: variable a
location: class Program
1 error
Name | Type | Code | Language |
---|---|---|---|
Unclosed character literal | Compile-time Error | java.lang.UnclosedCharacterLiteralError | Java |
A character literal (in single quotes) is not closed properly in the code.
public class UnclosedCharacterLiteralError {
public static void main(String[] args) {
char ch = 'Hello World'; // This will cause an error because the character literal is not closed.
}
}
UnclosedCharacterLiteralError.java:4: error: unclosed character literal
char ch = 'Hello World'; // This will cause an error because the character literal is not closed.
^
UnclosedCharacterLiteralError.java:4: error: unclosed character literal
char ch = 'Hello World'; // This will cause an error because the character literal is not closed.
^
2 errors
Name | Type | Code | Language |
---|---|---|---|
Illegal character | Compile-time Error | java.lang.IllegalCharacterError | Java |
A character used is illegal within the context of the code.
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!"+\uFEFF); // Error: Illegal character (BOM)
}
}
Main.java:3: error: illegal character: '\ufeff'
System.out.println("Hello, World!"+\uFEFF); // Error: Illegal character (BOM)
^
1 error
Name | Type | Code | Language |
---|---|---|---|
Not a statement | Compile-time Error | java.lang.NotAStatementError | Java |
The code does not represent a valid statement in the context of the language.
// NotAStatement.java
public class NotAStatement {
public static void main(String[] args) {
"test";
}
}
NotAStatement.java:3: error: not a statement
"test";
^
1 error
Name | Type | Code | Language |
---|---|---|---|
Illegal start of expression | Compile-time Error | java.lang.IllegalExpressionStartError | Java |
The code contains an illegal start for a particular expression.
public class Main {
public static void main(String[] args) {
// Attempting to use an illegal expression start
int x = (int) + * 5;
System.out.println(x);
}
}
Main.java:4: error: illegal start of expression
int x = (int) + * 5;
^
1 error
Name | Type | Code | Language |
---|---|---|---|
... is already defined in ... | Compile-time Error | java.lang.AlreadyDefinedError | Java |
Attempting to re-declare or redefine a variable, method, or class that's already defined elsewhere.
// Main.java
public class Main {
public static void main(String[] args) {
int x = 5;
// Attempting to redeclare the variable 'x'
int x = 10;
System.out.println(x);
}
}
Main.java:5: error: variable x is already defined in method main(String[])
int x = 10;
^
1 error
Name | Type | Code | Language |
---|---|---|---|
UnsupportedOperationException | Runtime Exception | java.lang.UnsupportedOperationError | Java |
An unsupported operation is attempted, typically in collection modification.
Add code here
Add message here
Name | Type | Code | Language |
---|---|---|---|
Array required, but found | Compile-time Error | java.lang.ArrayRequiredError | Java |
An array was expected, but a different type was found in the code.
public class NotArray {
public static void main(String[] args) {
int number = 5;
int value = number[0];
}
}
NotArray.java:4: error: array required, but int found
int value = number[0];
^
1 error
Name | Type | Code | Language |
---|---|---|---|
Forget to create object in accessing a non-static method | Compile-time Error | java.lang.NonStaticMethodAccessError | Java |
Accessing a non-static method without creating an object of its class.
public class Main {
// Non-static method
public void printMessage() {
System.out.println("Hello, World!");
}
public static void main(String[] args) {
// Attempt to call the non-static method without creating an object
printMessage(); // This will result in an error
}
}
Main.java:9: error: non-static method printMessage() cannot be referenced from a static context
printMessage(); // This will result in an error
^
1 error
Name | Type | Code | Language |
---|---|---|---|
NegativeArraySizeException | Runtime Exception | java.lang.NegativeArraySizeError | Java |
An attempt to create an array with a negative size.
public class Main {
public static void main(String[] args) {
// Attempting to create an array with a negative size
int[] array = new int[-5];
System.out.println(array.length);
}
}
Exception in thread "main" java.lang.NegativeArraySizeException: -5
at Main.main(Main.java:4)
Name | Type | Code | Language |
---|---|---|---|
java.util.StringIndexOutOfBoundsException | Runtime Exception | java.util.StringIndexOutOfBoundsException | Java |
An attempt to access a string's index that is out of its range.
public class Main {
public static void main(String[] args) {
String text = "Hello, World!";
// Attempting to access an index beyond the string's length
char character = text.charAt(20);
System.out.println(character);
}
}
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 20
at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47)
at java.base/java.lang.String.charAt(String.java:693)
at Main.main(Main.java:5)
Name | Type | Code | Language |
---|---|---|---|
AttributeError | Runtime Exception | python.lang.AttributeError | Python |
Raised when an attribute reference or assignment fails.
# Sample program that triggers AttributeError
x = 5
x.append(3)
Traceback (most recent call last):
File "attribute_error.py", line 3, in <module>
x.append(3)
AttributeError: 'int' object has no attribute 'append'
Name | Type | Code | Language |
---|---|---|---|
Possible loss of precision | Compile-time Error | java.lang.PrecisionLossError | Java |
A potential loss of precision is identified, usually in numerical conversions.
// PrecisionLoss.java
public class PrecisionLoss {
public static void main(String[] args) {
double largeNumber = 12345678901234567890.123456789;
// Potential loss of precision: Found double, required float
float smallNumber = largeNumber;
}
}
PrecisionLoss.java:7: error: incompatible types: possible lossy conversion from double to float
float smallNumber = largeNumber;
^
1 error
Name | Type | Code | Language |
---|---|---|---|
Code outside a method/main method class | Compile-time Error | java.lang.CodeOutsideMethodError | Java |
Code found outside any method or the main method class.
public class Main {
int x = 5;
System.out.println("Hello, World!");
public static void main(String[] args) {
System.out.println("Inside the main method.");
}
}
Main.java:4: error: <identifier> expected
System.out.println("Hello, World!");
^
Main.java:4: error: illegal start of type
System.out.println("Hello, World!");
^
2 errors
Name | Type | Code | Language |
---|---|---|---|
MethodNotFoundError | Runtime Exception | java.lang.MethodNotFoundError | Java |
The method being called or referenced cannot be found or does not exist.
// Test.java
public class Test {
public static void main(String[] args) {
int[] numbers = {1, 2, 3, 4, 5};
// Attempting to call a non-existing method
displayArray(numbers);
}
}
Test.java:4: error: cannot find symbol
displayArray(numbers);
^
symbol: method displayArray(int[])
location: class Test
1 error
Name | Type | Code | Language |
---|---|---|---|
NameError | Runtime Exception | python.lang.NameError | Python |
Raised when a local or global name is not found.
print(test)
Traceback (most recent call last):
File "name_error.py", line 1, in <module>
print(test)
^^^^
NameError: name 'test' is not defined
Name | Type | Code | Language |
---|---|---|---|
... has private access in ... | Compile-time Error | java.lang.PrivateAccessError | Java |
Accessing a member with private access from an external class or context.
public class Main {
public static void main(String[] args) {
AnotherClass anotherClass = new AnotherClass();
// Attempting to access a private variable from another class
int value = anotherClass.privateVariable;
System.out.println(value);
}
}
class AnotherClass {
private int privateVariable = 10;
}
Main.java:5: error: privateVariable has private access in AnotherClass
int value = anotherClass.privateVariable;
^
1 error
Name | Type | Code | Language |
---|---|---|---|
class is public, should be declared in a file named .java | Compile-time Error | java.lang.PublicClassFilenameMismatchError | Java |
The public class needs to be in a file with the same name in Java.
public class Right {
public static void main(String[] args) {
}
}
Wrong.java:1: error: class Right is public, should be declared in a file named Right.java
public class Right {
^
1 error
Name | Type | Code | Language |
---|---|---|---|
ConcurrentModificationException | Runtime Exception | java.lang.ConcurrentModificationException | Java |
An attempt to modify a collection while iterating over it concurrently.
Add code here
Add message here
Name | Type | Code | Language |
---|---|---|---|
Incompatible/inconvertible types | Compile-time Error | java.lang.IncompatibleTypesError | Java |
Types in the code are incompatible and cannot be converted or used together.
// IncompatibleTypes.java
public class IncompatibleTypes {
public static void main(String[] args) {
int number = 10;
String text = "Hello";
// Incompatible types: Cannot convert int to String
text = number;
}
}
IncompatibleTypes.java:7: error: incompatible types: int cannot be converted to String
text = number;
^
1 error
Name | Type | Code | Language |
---|---|---|---|
Variable ... might not have been initialized | Compile-time Error | java.lang.UninitializedVariableError | Java |
Using a variable that might not have been initialized with a value.
// UninitializedVariable.java
public class UninitializedVariable {
public static void main(String[] args) {
int number;
// Variable 'number' might not have been initialized
System.out.println(number);
}
}
UninitializedVariable.java:6: error: variable number might not have been initialized
System.out.println(number);
^
1 error
Name | Type | Code | Language |
---|---|---|---|
Variable not found | Compile-time Error | java.lang.VariableNotFoundError | Java |
The specified variable cannot be found within the scope.
public class Program {
public static void main(String[] args) {
System.out.println(a);
}
}
Program.java:3: error: cannot find symbol
System.out.println(a);
^
symbol: variable a
location: class Program
1 error
Name | Type | Code | Language |
---|---|---|---|
Unreachable statement | Compile-time Error | java.lang.UnreachableStatementException | Java |
The code contains a statement that cannot be reached in the program's flow.
public class Unreachable {
public static void main(String[] args) {
System.out.println("b");
return;
System.out.println("c");
}
}
Unreachable.java:5: error: unreachable statement
System.out.println("c");
^
1 error
Name | Type | Code | Language |
---|---|---|---|
java.util.NumberFormatException | Runtime Exception | java.util.NumberFormatError | Java |
Parsing a string into a number format that's invalid.
Add code here
Add message here
Name | Type | Code | Language |
---|---|---|---|
Reached end of file while parsing | Compile-time Error | java.lang.ParseEndOfFileError | Java |
The compiler reached the end of the file unexpectedly while parsing the code.
public class EOF {
public static void main(String[] args) {
System.out.println("This is a sample program.");
}
EOF.java:4: error: reached end of file while parsing
}
^
1 error
Name | Type | Code | Language |
---|---|---|---|
Mismatched brackets/parentheses | Compile-time Error | java.lang.BracketMismatchError | Java |
There is an unequal number of opening and closing brackets or parentheses.
// BracketMismatch.java
public class BracketMismatch {
public static void main(String[] args) {
int x = 10;
if (x > 5) {
System.out.println("x is greater than 5.");
} // Missing closing bracket for if statement
}
}
BracketMismatch.java:7: error: '}' expected
System.out.println("x is greater than 5.");
^
1 error
Name | Type | Code | Language |
---|---|---|---|
java.util.InputMismatchException | Runtime Exception | java.util.InputMismatchError | Java |
Input of a different type than expected (e.g., parsing an int but receiving a String).
Add code here
Add message here
Name | Type | Code | Language |
---|---|---|---|
IndentationError | Compile-time Error | python.lang.IndentationError | Python |
Raised when indentation is not correctly specified.
def my_function():
print("Hello, world!")
print("This line is indented with two spaces instead of four.")
File "indentation_error.py", line 3
print("This line is indented with two spaces instead of four.")
^
IndentationError: unindent does not match any outer indentation level
Name | Type | Code | Language |
---|---|---|---|
Illegal Start of type | Compile-time Error | java.lang.IllegalStartTypeError | Java |
The code has an illegal start for a specific type (class, interface, etc.).
// https://stackoverflow.com/questions/2448768/why-does-the-program-give-illegal-start-of-type-error
public class Rand {
public static Rand searchCount() {
Rand countA = new Rand() ;
}
return countA ;
}
}
Rand.java:11: error: illegal start of type
return countA ;
^
1 error
Name | Type | Code | Language |
---|---|---|---|
ClassCastException | Runtime Exception | java.lang.ClassCastError | Java |
An attempt to cast an object to a type to which it is not compatible.
public class Main {
public static void main(String[] args) {
Object obj = "Hello, World!";
Integer number = (Integer) obj;
}
}
Exception in thread "main" java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader 'bootstrap')
at Main.main(Main.java:5)
Name | Type | Code | Language |
---|---|---|---|
ArrayIndexOutOfBoundsException | Runtime Exception | java.lang.ArrayIndexOutOfBoundsException | Java |
An attempt to access an array element with an index outside the allowed range.
public class Arith {
public static void main(String[] args) {
double out = 3 / 0;
System.out.println(out);
}
}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 5 out of bounds for length 4
at OOB.main(OOB.java:4)
Name | Type | Code | Language |
---|---|---|---|
ArithmeticException | Runtime Exception | java.lang.ArithmeticException | Java |
Generic arithmetic error, like division by zero or an overflow.
public class Arith {
public static void main(String[] args) {
double out = 3 / 0;
System.out.println(out);
}
}
Exception in thread "main" java.lang.ArithmeticException: / by zero
at Arith.main(Arith.java:3)
Name | Type | Code | Language |
---|---|---|---|
... in ... cannot be applied to | Compile-time Error | java.lang.CannotBeAppliedError | Java |
The method or operation cannot be applied to the given arguments or context.
// CannotBeApplied.java
public class CannotBeApplied {
public static void main(String[] args) {
String text = "Hello";
// Method 'charAt' cannot be applied to String with arguments
char firstChar = text.charAt(0, 1);
}
}
CannotBeApplied.java:7: error: method charAt in class String cannot be applied to given types;
char firstChar = text.charAt(0, 1);
^
required: int
found: int,int
reason: actual and formal argument lists differ in length
1 error
Name | Type | Code | Language |
---|---|---|---|
Unclosed string literal | Compile-time Error | java.lang.UnclosedStringLiteralError | Java |
A string literal (in double quotes) is not closed properly in the code.
public class Main {
public static void main(String[] args) {
// Unclosed string literal
String message = "Hello, World!;
System.out.println(message);
}
}
Main.java:4: error: unclosed string literal
String message = "Hello, World!;
^
1 error
Name | Type | Code | Language |
---|---|---|---|
Invalid method declaration | Compile-time Error | java.lang.InvalidMethodDeclarationError | Java |
The method declaration is invalid or incorrect in syntax.
class InvalidMethodExample {
public static void main(String[] args) {
int result = addNumbers(5, 10);
System.out.println("Sum: " + result);
}
// Invalid method declaration with missing return type
addNumbers(int a, int b) {
return a + b;
}
}
InvalidMethodExample.java:8: error: invalid method declaration; return type required
addNumbers(int a, int b) {
^
1 error
Name | Type | Code | Language |
---|---|---|---|
java.util.NoSuchElementException | Runtime Exception | java.util.NoSuchElementException | Java |
There's no element available in a collection when one is expected.
// Main.java
import java.util.*;
public class Main {
public static void main(String[] args) {
List<String> myList = new ArrayList<>();
Iterator<String> iterator = myList.iterator();
// Attempting to get an element from an empty list
String element = iterator.next();
System.out.println(element);
}
}
Exception in thread "main" java.util.NoSuchElementException
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:1052)
at Main.main(Main.java:8)
Name | Type | Code | Language |
---|---|---|---|
java.lang.ArithmeticException: / by zero | Runtime Exception | java.lang.DivisionByZeroError | Java |
An arithmetic operation attempted division by zero.
Add code here
Add message here
Name | Type | Code | Language |
---|---|---|---|
java.util.FileNotFoundException | Runtime Exception | java.util.FileNotFoundError | Java |
An attempt to access a file that does not exist or cannot be opened.
Add code here
Add message here
Name | Type | Code | Language |
---|---|---|---|
Class not found | Compile-time Error | java.lang.ClassNotFoundError | Java |
The specified class cannot be found within the program or libraries.
Add code here
Add message here
Name | Type | Code | Language |
---|---|---|---|
DateTimeException | Runtime Exception | java.lang.DateTimeError | Java |
Exception thrown when an error occurs while dealing with date and time.
Add code here
Add message here
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.