Netflix/Hystrix · error · IllegalArgumentException
HystrixNetworkAuditorEventListener can not be NULL
Error message
HystrixNetworkAuditorEventListener can not be NULL
What it means
HystrixNetworkAuditorAgent is a javaagent that forwards socket/NIO activity to a registered HystrixNetworkAuditorEventListener (the 'bridge'). registerEventListener guards its single required argument with an explicit null check throwing IllegalArgumentException, because a null bridge would silently disable all network-event auditing.
Source
Thrown at hystrix-contrib/hystrix-network-auditor-agent/src/main/java/com/netflix/hystrix/contrib/networkauditor/HystrixNetworkAuditorAgent.java:54
inst.addTransformer(new NetworkClassTransform());
}
/**
* Invoked by instrumented code when network access occurs.
*/
public static void notifyOfNetworkEvent() {
bridge.handleNetworkEvent();
}
/**
* Register the implementation of the {@link HystrixNetworkAuditorEventListener} that will receive the events.
*
* @param bridge
* {@link HystrixNetworkAuditorEventListener} implementation
*/
public static void registerEventListener(HystrixNetworkAuditorEventListener bridge) {
if (bridge == null) {
throw new IllegalArgumentException("HystrixNetworkAuditorEventListener can not be NULL");
}
HystrixNetworkAuditorAgent.bridge = bridge;
}
}
View on GitHub (pinned to 5ce3bc58c3)
Solutions
- Fix the construction path so the listener instance is non-null before registering (check the DI bean exists)
- Register defensively only when the listener is available, failing fast with a clear boot error if the auditor is enabled without a listener
- Pass a no-op implementation rather than null if auditing is optional in some profiles
- Add a startup assertion/log immediately after registration
Example fix
// before
HystrixNetworkAuditorAgent.registerEventListener(listenerBean()); // may return null
// after
HystrixNetworkAuditorEventListener listener = listenerBean();
if (listener == null) throw new IllegalStateException("network auditor enabled but no listener configured");
HystrixNetworkAuditorAgent.registerEventListener(listener); Defensive patterns
Strategy: validation
Validate before calling
if (listener == null) {
throw new IllegalStateException("Network auditor enabled but listener is null — check DI wiring");
}
HystrixNetworkAuditorAgent.registerEventListener(listener); Type guard
null // Java: use Objects.requireNonNull; no type-narrowing involved Objects.requireNonNull(listener, "auditor listener");
Try / catch
catch (IllegalArgumentException e) { log.error("registerEventListener(null) — fix listener construction", e); failBoot(e); } Prevention
- Fail fast if the auditor is enabled without a listener bean
- Register in the same place the listener is constructed
- Pass a no-op listener for disabled profiles instead of null
When it happens
Trigger: Calling HystrixNetworkAuditorAgent.registerEventListener(null) — typically from agent premain/application boot code that failed to construct the listener (e.g. dependency injection returned null, or a config-driven conditional listener that was never created).
Common situations: Wiring the auditor agent in a DI container where the listener bean is missing/conditional; test harnesses registering a no-op that evaluates to null; refactoring listener construction so the instance is created after registration is attempted.
Related errors
- Failed trying to wrap class: " + className
- Failed trying to wrap constructor of class: " + className
- Failed trying to wrap method [" + method.getName() + "] of c
- method cannot be annotated with HystrixCommand and HystrixCo
- Collapser method must have one argument: {}
AI-assisted analysis of Netflix/Hystrix@5ce3bc58c3 (2026-08-14).
Data as JSON: /api/errors/e7b58c6a4e66ee4a.
Report an issue: GitHub.