Netflix/Hystrix · error · IllegalStateException
Another strategy was already registered.
Error message
Another strategy was already registered.
What it means
HystrixPlugins stores global strategy implementations in AtomicReferences; registerEventNotifier(impl) succeeds only if the slot is empty (compareAndSet(null, impl)) — otherwise IllegalStateException('Another strategy was already registered.'). The same guard applies to all register* methods; registration also fails implicitly once the default/property-loaded implementation was fetched, because that instantiation occupies the slot.
Source
Thrown at hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixPlugins.java:152
} else {
// we received an implementation from Archaius so use it
notifier.compareAndSet(null, (HystrixEventNotifier) impl);
}
}
return notifier.get();
}
/**
* Register a {@link HystrixEventNotifier} implementation as a global override of any injected or default implementations.
*
* @param impl
* {@link HystrixEventNotifier} implementation
* @throws IllegalStateException
* if called more than once or after the default was initialized (if usage occurs before trying to register)
*/
public void registerEventNotifier(HystrixEventNotifier impl) {
if (!notifier.compareAndSet(null, impl)) {
throw new IllegalStateException("Another strategy was already registered.");
}
}
/**
* Retrieve instance of {@link HystrixConcurrencyStrategy} to use based on order of precedence as defined in {@link HystrixPlugins} class header.
* <p>
* Override default by using {@link #registerConcurrencyStrategy(HystrixConcurrencyStrategy)} or setting property (via Archaius): <code>hystrix.plugin.HystrixConcurrencyStrategy.implementation</code> with the
* full classname to load.
*
* @return {@link HystrixConcurrencyStrategy} implementation to use
*/
public HystrixConcurrencyStrategy getConcurrencyStrategy() {
if (concurrencyStrategy.get() == null) {
// check for an implementation from Archaius first
Object impl = getPluginImplementation(HystrixConcurrencyStrategy.class);
if (impl == null) {
// nothing set via Archaius so initialize with default
concurrencyStrategy.compareAndSet(null, HystrixConcurrencyStrategyDefault.getInstance());View on GitHub (pinned to 5ce3bc58c3)
Solutions
- Register every plugin exactly once, as early as possible (main()/contextCreated before any command executes)
- When composing multiple behaviors, register a single composite notifier that delegates to all implementations instead of registering several
- If already initialized, call Hystrix.reset() (resets plugins in newer versions) before re-registering — primarily a test-context tool
- Check state defensively: plugins.getEventNotifier() instanceof default before registering to give a clearer error
Example fix
// before
HystrixPlugins.getInstance().registerEventNotifier(a);
HystrixPlugins.getInstance().registerEventNotifier(b); // ISE
// after
HystrixPlugins.getInstance().registerEventNotifier(new CompositeNotifier(a, b));
// class CompositeNotifier extends HystrixEventNotifierDefault {
// ...delegate each callback to a and b... } Defensive patterns
Strategy: validation
Validate before calling
// before registering, confirm the slot is still open HystrixPlugins p = HystrixPlugins.getInstance(); boolean slotOpen = (p.getEventNotifier() instanceof HystrixEventNotifierDefault); // default => unregistered // note: this check itself initializes the slot; do it only in diagnostics
Type guard
null
Try / catch
catch (IllegalStateException e) { if ("Another strategy was already registered.".equals(e.getMessage())) { // compose instead: wrap HystrixPlugins.getInstance().getEventNotifier() in a delegating notifier — but note re-registration is impossible; fix init order } } Prevention
- Register all plugins once, at the earliest startup point, before any command executes
- Compose multiple behaviors into one delegating implementation instead of registering several
- Call Hystrix.reset() between test suites that re-register plugins
When it happens
Trigger: Calling HystrixPlugins.getInstance().registerEventNotifier(...) a second time, or registering after any code has already retrieved (and thereby lazily initialized) the event notifier — e.g. a first command executed before your registration runs.
Common situations: Two libraries/framework modules each registering their notifier (common in shared service templates); registering plugins in a non-deterministic @Configuration while metrics publishers already initialized; re-registrations in hot-reload/test contexts where HystrixPlugins retains state between test classes.
Related errors
- HystrixCommandGroup can not be NULL
- " + getLogMessagePrefix() + " command executed multiple time
- HystrixCollapser failed while executing.
- No fallback available.
- Not an event that can be converted to HystrixEventType : {ev
AI-assisted analysis of Netflix/Hystrix@5ce3bc58c3 (2026-08-14).
Data as JSON: /api/errors/98b205dc3a3a1189.
Report an issue: GitHub.