Netflix/Hystrix · error · RuntimeException
Command should implement {} interface to execute in observab
Error message
Command should implement {} interface to execute in observable mode What it means
For ExecutionType.OBSERVABLE the invokable must implement HystrixObservable (i.e. be a HystrixObservableCommand). Javanica throws this RuntimeException when the factory produced a plain HystrixCommand-based invokable (GenericCommand, which implements HystrixExecutable but not HystrixObservable) while the dispatch path tries observe()/toObservable() — again an invokable-kind vs execution-type mismatch.
Source
Thrown at hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/CommandExecutor.java:82
return ObservableExecutionMode.EAGER == metaHolder.getObservableExecutionMode() ? observable.observe() : observable.toObservable();
}
default:
throw new RuntimeException("unsupported execution type: " + executionType);
}
}
private static HystrixExecutable castToExecutable(HystrixInvokable invokable, ExecutionType executionType) {
if (invokable instanceof HystrixExecutable) {
return (HystrixExecutable) invokable;
}
throw new RuntimeException("Command should implement " + HystrixExecutable.class.getCanonicalName() + " interface to execute in: " + executionType + " mode");
}
private static HystrixObservable castToObservable(HystrixInvokable invokable) {
if (invokable instanceof HystrixObservable) {
return (HystrixObservable) invokable;
}
throw new RuntimeException("Command should implement " + HystrixObservable.class.getCanonicalName() + " interface to execute in observable mode");
}
}
View on GitHub (pinned to 5ce3bc58c3)
Solutions
- Align hystrix-javanica and hystrix-core versions and remove duplicate javanica jars (mvn dependency:tree | grep hystrix).
- If you customize the command factory, return HystrixObservableCommand-based invokables (e.g. GenericObservableCommand) whenever metaHolder execution type is OBSERVABLE.
- Reproduce with a minimal method returning Observable<T> to confirm stock javanica works, then bisect your customizations.
Example fix
// custom factory sketch
// before
if (metaHolder.isObservable()) {
return new GenericCommand(metaHolder); // wrong kind for OBSERVABLE
}
// after
if (metaHolder.isObservable()) {
return new GenericObservableCommand(metaHolder); // implements HystrixObservable
} Defensive patterns
Strategy: try-catch
Try / catch
try { ... } catch (RuntimeException e) when message contains 'Command should implement' → log observable-mode mismatch (invokable class + executionType) and rethrow; not retryable. Prevention
- Align hystrix-core and hystrix-javanica versions; eliminate duplicate javanica jars.
- If overriding HystrixCommandFactory, add a unit test per ExecutionType asserting the invokable implements HystrixExecutable/HystrixObservable accordingly.
When it happens
Trigger: Method/return-type metadata resolved to OBSERVABLE execution while the constructed invokable is a plain GenericCommand — e.g. custom factory overrides, collapser batch meta-holder built from a non-observable command but executed in observable mode, or skewed javanica versions.
Common situations: Extending HystrixCommandFactory without handling all execution types; mixing javanica jar versions so factory selection and execution-type derivation disagree; edge-case collapser signatures.
Related errors
- Command should implement {} interface to execute in: {} mode
- unsupported execution type: {}
- unsupported rx type: {}
- fallback cannot return Observable if command isn't observabl
- method cannot be annotated with HystrixCommand and HystrixCo
AI-assisted analysis of Netflix/Hystrix@5ce3bc58c3 (2026-08-14).
Data as JSON: /api/errors/b06756d288d7f156.
Report an issue: GitHub.