{"record":{"id":"5249019bd3f7f74c","repo":"Netflix/Hystrix","slug":"not-an-event-that-can-be-converted-to-hystrixevent-524901","errorCode":null,"errorMessage":"Not an event that can be converted to HystrixEventType.Collapser : {event}","messagePattern":"Not an event that can be converted to HystrixEventType\\.Collapser : (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hystrix-core/src/main/java/com/netflix/hystrix/HystrixEventType.java","lineNumber":141,"sourceCode":"                case FAILURE: return EXECUTED;\n                case TIMEOUT: return EXECUTED;\n                case BAD_REQUEST: return EXECUTED;\n                case THREAD_POOL_REJECTED: return REJECTED;\n                default: return null;\n            }\n        }\n    }\n\n    public enum Collapser {\n        BATCH_EXECUTED, ADDED_TO_BATCH, RESPONSE_FROM_CACHE;\n\n        public static Collapser from(HystrixRollingNumberEvent event) {\n            switch (event) {\n                case COLLAPSER_BATCH: return BATCH_EXECUTED;\n                case COLLAPSER_REQUEST_BATCHED: return ADDED_TO_BATCH;\n                case RESPONSE_FROM_CACHE: return RESPONSE_FROM_CACHE;\n                default:\n                    throw new RuntimeException(\"Not an event that can be converted to HystrixEventType.Collapser : \" + event);\n            }\n        }\n    }\n}\n","sourceCodeStart":123,"sourceCodeEnd":146,"githubUrl":"https://github.com/Netflix/Hystrix/blob/5ce3bc58c38e7ca60ef2fe0e516e390e294ad941/hystrix-core/src/main/java/com/netflix/hystrix/HystrixEventType.java#L123-L146","documentation":"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>').","triggerScenarios":"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.","commonSituations":"Custom metrics publishers/dashboards consuming HystrixCollapserMetrics streams that forward unfiltered rolling-number events; code adapted from command-metrics consumers without adjusting the event filter.","solutions":["Filter to COLLAPSER_BATCH / COLLAPSER_REQUEST_BATCHED / RESPONSE_FROM_CACHE before conversion","Branch on the metric source (command vs collapser vs thread-pool) and call the matching from() overload","Cover all enum values in a converter unit test"],"exampleFix":"// before\nHystrixEventType.Collapser c = HystrixEventType.Collapser.from(event); // throws on SUCCESS\n// after\nswitch (event) {\n  case COLLAPSER_BATCH: case COLLAPSER_REQUEST_BATCHED: case RESPONSE_FROM_CACHE:\n    HystrixEventType.Collapser c = HystrixEventType.Collapser.from(event); break;\n  default: /* command/threadpool event — ignore */ }\n","handlingStrategy":"validation","validationCode":"static boolean isCollapserEvent(HystrixRollingNumberEvent e) {\n  return e == HystrixRollingNumberEvent.COLLAPSER_BATCH\n      || e == HystrixRollingNumberEvent.COLLAPSER_REQUEST_BATCHED\n      || e == HystrixRollingNumberEvent.RESPONSE_FROM_CACHE; }","typeGuard":"null","tryCatchPattern":"Not intended to be caught — filter to the three mappable collapser events before calling from().","preventionTips":["Dispatch on metric source before enum conversion","Test custom metrics bridges with mixed event streams"],"tags":["java","hystrix","metrics","collapser","enum-conversion"],"backgroundTag":null,"analyzedSha":"5ce3bc58c38e7ca60ef2fe0e516e390e294ad941","analyzedAt":"2026-08-14T10:55:35.600Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}