nathanmarz/storm · error · RuntimeException

Unsuppoted object type

Error message

Unsuppoted object type ${obj.getClass().getName()}

What it means

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.

Solutions

  1. Wrap payloads in a TaskMessage before adding them to the batch.
  2. Use the appropriate ControlMessage subtype for control traffic.
  3. Extend MessageBatch (or fork) only if you genuinely need a new encoded type, adding a branch and encodeLength handling.

Example fix

// before
batch.add(payloadBytes);
// after
batch.add(new TaskMessage(taskId, payloadBytes));
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(obj instanceof TaskMessage) && !(obj instanceof ControlMessage)) {
    throw new IllegalArgumentException("MessageBatch accepts only TaskMessage/ControlMessage: " + obj);
}

Type guard

boolean isEncodable(Object o) {
    return o instanceof TaskMessage || o instanceof ControlMessage;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of nathanmarz/storm@cdb116e942 (2026-09-12). Data as JSON: /api/errors/cd7ba344c44de2cd. Report an issue: GitHub.

Appendix: source

Thrown at storm-netty/src/jvm/backtype/storm/messaging/netty/MessageBatch.java:58

    void add(Object obj) {
        if (obj == null)
            throw new RuntimeException("null object forbidded in message batch");

        if (obj instanceof TaskMessage) {
            TaskMessage msg = (TaskMessage)obj;
            msgs.add(msg);
            encoded_length += msgEncodeLength(msg);
            return;
        }

        if (obj instanceof ControlMessage) {
            ControlMessage msg = (ControlMessage)obj;
            msgs.add(msg);
            encoded_length += msg.encodeLength();
            return;
        }

        throw new RuntimeException("Unsuppoted object type "+obj.getClass().getName());
    }

    void remove(Object obj) {
        if (obj == null) return;

        if (obj instanceof TaskMessage) {
            TaskMessage msg = (TaskMessage)obj;
            msgs.remove(msg);
            encoded_length -= msgEncodeLength(msg);
            return;
        }

        if (obj instanceof ControlMessage) {
            ControlMessage msg = (ControlMessage)obj;
            msgs.remove(msg);
            encoded_length -= msg.encodeLength();
            return;
        }

View on GitHub (pinned to cdb116e942)