How to Fix InvocationTargetException
InvocationTargetException only wraps the real error. Read the Caused by lines below it; the last one is usually where the problem started.
Quick Fix
Scroll past InvocationTargetException to the Caused by lines under it. The last Caused by names the real exception, and the lines below it show which mod, plugin or library threw it.
Error Message
java.lang.reflect.InvocationTargetExceptionHow to Fix
Find the first line starting with Caused by: below the InvocationTargetException. That is the exception the called code actually threw.
If there are several Caused by: lines, keep going to the last one. Each is the cause of the one above it, so the bottom one is where the failure started.
Look at the at lines right under that last Caused by. A package name such as com.example.somemod tells you which mod, plugin or library the code belongs to.
Search for that underlying exception rather than for InvocationTargetException, and fix it: update or remove the mod, correct its config, or install the dependency it names.
Lines like ... 12 more don't hide anything important. They mean the rest of that trace matches the trace printed above it.
Common Causes
- Code that was called through Java reflection threw an exception. Java wraps whatever the called method or constructor threw in an InvocationTargetException.
- A mod, plugin or library failed while it was being loaded or created through reflection, for example because of a missing dependency or a bad config value.
- The wrapped error is an ordinary exception, such as a NullPointerException, ClassNotFoundException or IllegalStateException, that happened inside the called code.
Diagnostic Steps
- Open the crash report or latest.log.
- Find java.lang.reflect.InvocationTargetException.
- Read down to the last Caused by: line.
- Note the exception name and the first package name below it.
- Fix or update that mod or plugin, then restart.
FAQ
Is this a real error?
It is a real exception, but it only reports that code called through reflection failed. The useful part is the exception it wraps, which Java prints underneath as Caused by:.
What does ... N more mean in a stack trace?
Java shortens repeated parts of a stack trace. The line means the remaining frames of that exception are the same as the bottom frames of the exception printed above it.
Why is there no message after InvocationTargetException?
The wrapper usually has no message of its own. Its cause, which code can read with getCause(), holds the actual exception and its message.
Related Errors
How to Fix java.lang.NullPointerException
java.lang.NullPointerException
How to Fix ExceptionInInitializerError
java.lang.ExceptionInInitializerError
How to Fix java.lang.RuntimeException
java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'examplemod' at 'com.example.ExampleMod'!
How to Read Minecraft Crash Reports
---- Minecraft Crash Report ----