oracle/graal · critical · IllegalArgumentException
illegal type for element %s: %s
Error message
illegal type for element %s: %s
What it means
After resolving java.home, DefaultHomeFinder verifies the path actually exists on disk via Files.exists. If the directory named by java.home has been deleted or is inaccessible (e.g. on an unmounted network share), it throws this AssertionError. It means the JVM is pointing at an installation root that is no longer present.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/annotation/AnnotationValue.java:121
private static void checkEntry(Map.Entry<String, Object> e) {
checkEntry0(e.getKey(), e.getValue(), true);
}
private static void checkEntry0(String key, Object value, boolean acceptList) {
if (value instanceof List<?> list) {
if (acceptList) {
int i = 0;
for (var element : list) {
checkEntry0(key + "[" + (i++) + "]", element, false);
}
return;
}
}
Class<?> valueClass = value.getClass();
if ((!ResolvedJavaType.class.isAssignableFrom(valueClass) &&
!ELEMENT_TYPES.contains(valueClass))) {
throw new IllegalArgumentException("illegal type for element " + key + ": " + valueClass.getName());
}
}
/**
* Returns whether this object represent an annotation parsing error. The error is accessible
* via {@link #getError()}.
*/
public boolean isError() {
return error != null;
}
/**
* Gets the annotation parsing error represented by this value or {@code null} if it does not
* represent an annotation parsing error.
*/
public AnnotationFormatError getError() {
return error;
}View on GitHub (pinned to a66e9ccd1d)
Solutions
- Verify the path in java.home exists (ls "$JAVA_HOME") and fix the environment variable or relaunch from a valid JDK.
- If the JDK lives on a network share, remount it or copy the JDK to local disk and point java.home there.
- Restart the process from a valid JDK installation rather than a moved/deleted one.
Defensive patterns
Strategy: validation
Validate before calling
Path jh = Paths.get(System.getProperty("java.home", ""));
if (!Files.isDirectory(jh)) {
throw new IllegalStateException("java.home does not exist: " + jh);
}
HomeFinder.findHome(); Prevention
- Run from a JDK installed on local, reliably mounted storage.
- In containers, verify the JDK path exists at startup before invoking GraalVM home lookup.
When it happens
Trigger: The JDK/JRE directory was deleted or moved while a process from it was still running; java.home points to a container path that is not mounted in the current namespace; NFS/SSHFS share temporarily unavailable when home lookup happens.
Common situations: Long-lived daemon processes that outlive their JDK directory; container images where java.home was baked to a path that is volume-shadowed; CI workspaces cleaned mid-run.
Related errors
- nargs not allowed
- %s missing element %s
- Cannot compare {JavaLangRuntimeVersion.__name__} to {type(ot
- Unexpected enum type: %s
- Cannot look up %s annotation at Native Image runtime
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/ec59f7a1302ec8eb.
Report an issue: GitHub.