Netflix/Hystrix · error · RuntimeException
HystrixCollapser failed while executing.
Error message
HystrixCollapser failed while executing.
What it means
In HystrixCollapser, unknown Throwables escaping the collapsed-command execution path are wrapped in a generic RuntimeException '<CollapserClass> HystrixCollapser failed while executing.' Only HystrixRuntimeExceptions (direct or as a cause) are rethrown as-is; everything else gets this wrapper so the failure still surfaces to the caller.
Source
Thrown at hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapser.java:441
* @throws HystrixRuntimeException
* if an error occurs and a fallback cannot be retrieved
*/
public ResponseType execute() {
try {
return queue().get();
} catch (Throwable e) {
if (e instanceof HystrixRuntimeException) {
throw (HystrixRuntimeException) e;
}
// if we have an exception we know about we'll throw it directly without the threading wrapper exception
if (e.getCause() instanceof HystrixRuntimeException) {
throw (HystrixRuntimeException) e.getCause();
}
// we don't know what kind of exception this is so create a generic message and throw a new HystrixRuntimeException
String message = getClass().getSimpleName() + " HystrixCollapser failed while executing.";
logger.debug(message, e); // debug only since we're throwing the exception and someone higher will do something with it
//TODO should this be made a HystrixRuntimeException?
throw new RuntimeException(message, e);
}
}
/**
* Used for asynchronous execution.
* <p>
* This will queue up the command and return a Future to get the result once it completes.
*
* @return ResponseType
* Result of {@link HystrixCommand}{@code <BatchReturnType>} execution after passing through {@link #mapResponseToRequests} to transform the {@code <BatchReturnType>} into
* {@code <ResponseType>}
* @throws HystrixRuntimeException
* within an <code>ExecutionException.getCause()</code> (thrown by {@link Future#get}) if an error occurs and a fallback cannot be retrieved
*/
public Future<ResponseType> queue() {
return toObservable()
.toBlocking()
.toFuture();View on GitHub (pinned to 5ce3bc58c3)
Solutions
- Inspect getCause() of this RuntimeException — it holds the real failure from the batch command
- Fix/handle the root exception inside the batch command run() or mapResponseToRequests
- Let the batch command translate failures into HystrixRuntimeException (fallbacks / command semantics) so they propagate unwrapped
- Add tests that exercise the collapser failure path to catch mapResponseToRequests bugs
Example fix
// before
try { collapser.queue().get(); } catch (ExecutionException e) { log.error("?", e); }
// after
try { collapser.queue().get(); }
catch (ExecutionException e) {
Throwable root = e.getCause() instanceof RuntimeException ? e.getCause().getCause() : e.getCause();
log.error("batch failed", root); // root is the real error
} Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
catch (RuntimeException e) { if (e.getMessage().endsWith("HystrixCollapser failed while executing.")) { Throwable root = e.getCause(); // handle real cause: retry, fallback, or translate } } Prevention
- Handle the cause chain, not the wrapper message
- Make batch commands translate known failures into HystrixRuntimeExceptions so they propagate unwrapped
- Test the collapser's failure path explicitly
When it happens
Trigger: A batch HystrixCommand run() throwing a non-Hystrix exception (NPE, IOException, etc.) during queue()/execute() of the collapser; errors inside mapResponseToRequests or the collapser's Scope plumbing bubbling up as raw Throwables.
Common situations: The underlying batch command's run() throws an unexpected runtime exception; a custom collapser's mapResponseToRequests has a bug; thread-uncaught errors (Errors, not Exceptions) escaping RxJava in older Hystrix 1.4/1.5 lines.
Related errors
- Not an event that can be converted to HystrixEventType.Colla
- Response has already terminated so response can not be set :
- Response has already terminated so exception can not be set
- Trying to start null batch which means it was shutdown alrea
- Collapser method must have one argument: {}
AI-assisted analysis of Netflix/Hystrix@5ce3bc58c3 (2026-08-14).
Data as JSON: /api/errors/6770039fb9a07645.
Report an issue: GitHub.