Netflix/Hystrix · error · IllegalArgumentException
wrong 'weavingMode' property, supported: " + Arrays.toString
Error message
wrong 'weavingMode' property, supported: " + Arrays.toString(WeavingMode.values()) + ", actual = " + EnvUtils.WEAVING_MODE
What it means
Javanica supports two AspectJ weaving modes via the system property 'weavingMode' (default RUNTIME). EnvUtils.getWeavingMode() parses that property with WeavingMode.valueOf; an unrecognized value (case-sensitive, and note the stored value is uppercased but must still match COMPILE or RUNTIME) throws IllegalArgumentException listing the supported values and the actual value found.
Source
Thrown at hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/EnvUtils.java:41
* Created by dmgcodevil
*/
public final class EnvUtils {
private static final String WEAVING_MODE;
static {
WEAVING_MODE = System.getProperty("weavingMode", WeavingMode.RUNTIME.name()).toUpperCase();
}
private EnvUtils(){
}
public static WeavingMode getWeavingMode() {
try {
return WeavingMode.valueOf(EnvUtils.WEAVING_MODE);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("wrong 'weavingMode' property, supported: " + Arrays.toString(WeavingMode.values()) + ", actual = " + EnvUtils.WEAVING_MODE, e);
}
}
public static boolean isCompileWeaving() {
return WeavingMode.COMPILE == getWeavingMode();
}
}
View on GitHub (pinned to 5ce3bc58c3)
Solutions
- Set the property to exactly COMPILE or RUNTIME, e.g. -DweavingMode=COMPILE
- If you weave at build time with the AspectJ maven/gradle plugin, use COMPILE; for Spring LTW/Spring AOP proxies use RUNTIME
- Search build scripts, IDE run configs, and JAVA_TOOL_OPTIONS for misspelled -DweavingMode values and remove duplicates
- Re-run the application
Example fix
# before java -DweavingMode=compile-time -jar app.jar # after java -DweavingMode=COMPILE -jar app.jar
Defensive patterns
Strategy: validation
Validate before calling
String mode = System.getProperty("weavingMode", "RUNTIME").trim().toUpperCase(Locale.ROOT);
if (!mode.equals("RUNTIME") && !mode.equals("COMPILE"))
throw new IllegalStateException("weavingMode must be RUNTIME or COMPILE, got: " + mode); Try / catch
catch (IllegalArgumentException e) { throw new IllegalStateException("Fix -DweavingMode (RUNTIME|COMPILE): " + e.getMessage(), e); } Prevention
- Standardize the weavingMode value in one build property inherited by all run configs
- Assert the property at app startup before AspectJ wiring kicks in
- Document the intended mode next to the aspect configuration
When it happens
Trigger: Running the JVM with -DweavingMode=compile-time, -DweavingMode=binary, or a typo like -DweavingMode=runntime; a build script or IDE run configuration injecting the wrong value.
Common situations: Switching a project from load-time weaving (Spring LTW, -javaagent:aspectjweaver) to compile-time weaving via annotation build plugins and setting the wrong string; CI pipelines passing the property differently from local runs; stale run configurations after upgrading javanica.
Related errors
- 'https://github.com/Netflix/Hystrix/issues/1458' - no valid
- Failed to set Thread Pool properties. {}
- Failed to set Command properties. {}
- unknown {} property: {}
- bad property value. property name '{}'. Expected int value,
AI-assisted analysis of Netflix/Hystrix@5ce3bc58c3 (2026-08-14).
Data as JSON: /api/errors/d84957d28d632606.
Report an issue: GitHub.