{"record":{"id":"cd7ba344c44de2cd","repo":"nathanmarz/storm","slug":"unsuppoted-object-type-obj-getclass-getname","errorCode":null,"errorMessage":"Unsuppoted object type ${obj.getClass().getName()}","messagePattern":"Unsuppoted object type (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"storm-netty/src/jvm/backtype/storm/messaging/netty/MessageBatch.java","lineNumber":58,"sourceCode":"    void add(Object obj) {\n        if (obj == null)\n            throw new RuntimeException(\"null object forbidded in message batch\");\n\n        if (obj instanceof TaskMessage) {\n            TaskMessage msg = (TaskMessage)obj;\n            msgs.add(msg);\n            encoded_length += msgEncodeLength(msg);\n            return;\n        }\n\n        if (obj instanceof ControlMessage) {\n            ControlMessage msg = (ControlMessage)obj;\n            msgs.add(msg);\n            encoded_length += msg.encodeLength();\n            return;\n        }\n\n        throw new RuntimeException(\"Unsuppoted object type \"+obj.getClass().getName());\n    }\n\n    void remove(Object obj) {\n        if (obj == null) return;\n\n        if (obj instanceof TaskMessage) {\n            TaskMessage msg = (TaskMessage)obj;\n            msgs.remove(msg);\n            encoded_length -= msgEncodeLength(msg);\n            return;\n        }\n\n        if (obj instanceof ControlMessage) {\n            ControlMessage msg = (ControlMessage)obj;\n            msgs.remove(msg);\n            encoded_length -= msg.encodeLength();\n            return;\n        }","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/nathanmarz/storm/blob/cdb116e942666973bc4eaa0df098d5bab82739e7/storm-netty/src/jvm/backtype/storm/messaging/netty/MessageBatch.java#L40-L76","documentation":"MessageBatch.add only accepts TaskMessage and ControlMessage instances; anything else has no wire encoding. It throws this RuntimeException (note the library's own typo 'Unsuppoted') at MessageBatch.java:58 with the offending class name.","triggerScenarios":"Adding an object that is neither TaskMessage nor ControlMessage to a MessageBatch via add (or tryAdd/takeMessages feeding it), e.g. raw byte arrays, Strings, or custom message types.","commonSituations":"Custom transports/interceptors queuing their own message types into a Storm MessageBatch; refactored code passing encoded byte[] instead of TaskMessage wrappers; unit-test stubs adding plain objects.","solutions":["Wrap payloads in a TaskMessage before adding them to the batch.","Use the appropriate ControlMessage subtype for control traffic.","Extend MessageBatch (or fork) only if you genuinely need a new encoded type, adding a branch and encodeLength handling."],"exampleFix":"// before\nbatch.add(payloadBytes);\n// after\nbatch.add(new TaskMessage(taskId, payloadBytes));","handlingStrategy":"type-guard","validationCode":"if (!(obj instanceof TaskMessage) && !(obj instanceof ControlMessage)) {\n    throw new IllegalArgumentException(\"MessageBatch accepts only TaskMessage/ControlMessage: \" + obj);\n}","typeGuard":"boolean isEncodable(Object o) {\n    return o instanceof TaskMessage || o instanceof ControlMessage;\n}","tryCatchPattern":null,"preventionTips":["Wrap raw payloads in TaskMessage before batching.","Keep custom message types out of the storm netty batch path.","Centralize batch construction so type constraints are enforced in one place."],"tags":["netty","batching","type-mismatch","messaging"],"backgroundTag":"type-mismatch","analyzedSha":"cdb116e942666973bc4eaa0df098d5bab82739e7","analyzedAt":"2026-09-12T14:30:00.714Z","contentChangedAt":"2026-09-12T14:30:00.714Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}