eclipse-vertx/vert.x · error · java.lang.IllegalStateException

Invalid type for message header value ${entry.getValue().get

Error message

Invalid type for message header value ${entry.getValue().getClass()}

What it means

JSON deserialization guard in the DeliveryOptions(JsonObject) constructor: a message header value in the 'headers' object is not a String (its actual class is reported in the message). Vert.x delivery headers only accept string values, so non-string JSON values are rejected during construction.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/eventbus/DeliveryOptions.java:90

    }
    this.localOnly = other.localOnly;
    this.tracingPolicy = other.tracingPolicy;
  }

  /**
   * Create a delivery options from JSON
   *
   * @param json  the JSON
   */
  public DeliveryOptions(JsonObject json) {
    this.timeout = json.getLong("timeout", DEFAULT_TIMEOUT);
    this.codecName = json.getString("codecName", null);
    JsonObject hdrs = json.getJsonObject("headers", null);
    if (hdrs != null) {
      headers = MultiMap.caseInsensitiveMultiMap();
      for (Map.Entry<String, Object> entry : hdrs) {
        if (!(entry.getValue() instanceof String)) {
          throw new IllegalStateException("Invalid type for message header value " + entry.getValue().getClass());
        }
        headers.set(entry.getKey(), (String) entry.getValue());
      }
    }
    this.localOnly = json.getBoolean("localOnly", DEFAULT_LOCAL_ONLY);
    String tracingPolicyStr = json.getString("tracingPolicy");
    this.tracingPolicy = tracingPolicyStr != null ? TracingPolicy.valueOf(tracingPolicyStr) : DEFAULT_TRACING_POLICY;
  }

  /**
   * Convert to JSON.
   *
   * @return the JSON
   */
  public JsonObject toJson() {
    JsonObject json = new JsonObject();
    json.put("timeout", timeout);
    if (codecName != null) json.put("codecName", codecName);

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Convert header values to strings in the JSON source
  2. Validate the headers object types before creating DeliveryOptions from JSON
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/eventbus/DeliveryOptions.java:90 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/e75654480188c921. Report an issue: GitHub.