Netflix/Hystrix · error · RuntimeException

Not an event that can be converted to HystrixEventType.Colla

Error message

Not an event that can be converted to HystrixEventType.Collapser : {event}

What it means

HystrixEventType.Collapser.from(HystrixRollingNumberEvent) maps only COLLAPSER_BATCH→BATCH_EXECUTED, COLLAPSER_REQUEST_BATCHED→ADDED_TO_BATCH, and RESPONSE_FROM_CACHE→RESPONSE_FROM_CACHE; any other rolling-number event reaches the default branch and throws RuntimeException('Not an event that can be converted to HystrixEventType.Collapser : <event>').

Source

Thrown at hystrix-core/src/main/java/com/netflix/hystrix/HystrixEventType.java:141

                case FAILURE: return EXECUTED;
                case TIMEOUT: return EXECUTED;
                case BAD_REQUEST: return EXECUTED;
                case THREAD_POOL_REJECTED: return REJECTED;
                default: return null;
            }
        }
    }

    public enum Collapser {
        BATCH_EXECUTED, ADDED_TO_BATCH, RESPONSE_FROM_CACHE;

        public static Collapser from(HystrixRollingNumberEvent event) {
            switch (event) {
                case COLLAPSER_BATCH: return BATCH_EXECUTED;
                case COLLAPSER_REQUEST_BATCHED: return ADDED_TO_BATCH;
                case RESPONSE_FROM_CACHE: return RESPONSE_FROM_CACHE;
                default:
                    throw new RuntimeException("Not an event that can be converted to HystrixEventType.Collapser : " + event);
            }
        }
    }
}

View on GitHub (pinned to 5ce3bc58c3)

Solutions

  1. Filter to COLLAPSER_BATCH / COLLAPSER_REQUEST_BATCHED / RESPONSE_FROM_CACHE before conversion
  2. Branch on the metric source (command vs collapser vs thread-pool) and call the matching from() overload
  3. Cover all enum values in a converter unit test

Example fix

// before
HystrixEventType.Collapser c = HystrixEventType.Collapser.from(event); // throws on SUCCESS
// after
switch (event) {
  case COLLAPSER_BATCH: case COLLAPSER_REQUEST_BATCHED: case RESPONSE_FROM_CACHE:
    HystrixEventType.Collapser c = HystrixEventType.Collapser.from(event); break;
  default: /* command/threadpool event — ignore */ }
Defensive patterns

Strategy: validation

Validate before calling

static boolean isCollapserEvent(HystrixRollingNumberEvent e) {
  return e == HystrixRollingNumberEvent.COLLAPSER_BATCH
      || e == HystrixRollingNumberEvent.COLLAPSER_REQUEST_BATCHED
      || e == HystrixRollingNumberEvent.RESPONSE_FROM_CACHE; }

Type guard

null

Try / catch

Not intended to be caught — filter to the three mappable collapser events before calling from().

Prevention

When it happens

Trigger: Passing command-domain events (SUCCESS, FAILURE, TIMEOUT, THREAD_EXECUTION...) or counter events into HystrixEventType.Collapser.from() — typically from a generic metrics loop that does not branch on event category.

Common situations: Custom metrics publishers/dashboards consuming HystrixCollapserMetrics streams that forward unfiltered rolling-number events; code adapted from command-metrics consumers without adjusting the event filter.

Related errors


AI-assisted analysis of Netflix/Hystrix@5ce3bc58c3 (2026-08-14). Data as JSON: /api/errors/5249019bd3f7f74c. Report an issue: GitHub.