eclipse-vertx/vert.x · error · IllegalArgumentException

No message codec for type:

Error message

No message codec for type: 

What it means

Codec lookup failure in CodecManager.lookupCodec: no message codec is registered for the message body's class. The message is a generic sentinel; the input at fault is the body object being sent on the event bus, whose type has no default codec, no system-codec, is not ClusterSerializable/Serializable (or those are not accepted in this mode), and no user codec was registered under a selected codec name.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/eventbus/impl/CodecManager.java:119

    } else if (body instanceof ReplyException) {
      codec = defaultCodecMap.get(body.getClass());
      if (codec == null) {
        codec = REPLY_EXCEPTION_MESSAGE_CODEC;
      }
    } else {
      codec = defaultCodecMap.get(body.getClass());
      if (codec == null) {
        if ((codecName = codecSelector.apply(body)) != null) {
          codec = getCodec(codecName);
        } else if (body instanceof ClusterSerializable && (local || acceptClusterSerializable(body.getClass().getName()))) {
          codec = clusterSerializableCodec;
        } else if (body instanceof Serializable && (local || acceptSerializable(body.getClass().getName()))) {
          codec = serializableCodec;
        }
      }
    }
    if (codec == null) {
      throw new IllegalArgumentException("No message codec for type: " + body.getClass());
    }
    return codec;
  }

  public MessageCodec getCodec(String codecName) {
    return userCodecMap.get(codecName);
  }

  public void registerCodec(MessageCodec codec) {
    Objects.requireNonNull(codec, "codec");
    Objects.requireNonNull(codec.name(), "code.name()");
    checkSystemCodec(codec);
    if (userCodecMap.containsKey(codec.name())) {
      throw new IllegalStateException("Already a codec registered with name " + codec.name());
    }
    userCodecMap.put(codec.name(), codec);
  }

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Register a MessageCodec for the body type via eventBus.registerDefaultCodec
  2. Send a supported type (String, JsonObject, byte[], ClusterSerializable, ...) instead
  3. For custom POJOs, provide a codec name via a CodecSelector
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/eventbus/impl/CodecManager.java:119 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06). Data as JSON: /api/errors/bce251f464b3b887. Report an issue: GitHub.