apache/beam · error · RuntimeException

No transformation defined for %s

Error message

No transformation defined for %s

What it means

RabbitMqMessage.getTransformedValue converts RabbitMQ header values to serializable forms; only LongString is supported. Any other header value type triggers a RuntimeException 'No transformation defined for %s', which is then wrapped (see error 2446) into an UnsupportedOperationException.

Source

Thrown at sdks/java/io/rabbitmq/src/main/java/org/apache/beam/sdk/io/rabbitmq/RabbitMqMessage.java:106

              ((List<?>) value)
                  .stream().map(RabbitMqMessage::getTransformedValue).collect(Collectors.toList());
        } else if (!(value instanceof Serializable)) {
          value = getTransformedValue(value);
        }
        returned.put(h.getKey(), value);
      }
    }
    return returned;
  }

  private static Object getTransformedValue(Object value) {
    try {
      if (value instanceof LongString) {
        LongString longString = (LongString) value;
        byte[] bytes = longString.getBytes();
        value = new String(bytes, StandardCharsets.UTF_8);
      } else {
        throw new RuntimeException(String.format("No transformation defined for %s", value));
      }
    } catch (Throwable t) {
      throw new UnsupportedOperationException(
          String.format(
              "Can't make unserializable value %s a serializable value (which is mandatory for Apache Beam dataflow implementation)",
              value),
          t);
    }
    return value;
  }

  private final @Nullable String routingKey;
  private final byte[] body;
  private final String contentType;
  private final String contentEncoding;
  private final Map<String, Object> headers;
  private final Integer deliveryMode;
  private final Integer priority;

View on GitHub (pinned to 12126d8942)

Solutions

  1. Change the producer to publish header values as LongString (e.g. new LongStringHelper.LongString(str.getBytes(UTF_8))).
  2. Filter out non-string headers before the Beam reader consumes them.
  3. Extend RabbitMqMessage to handle additional AMQP types (Integer, Boolean, octet) and convert them to serializable values.
  4. Move complex metadata into the message body instead of headers.

Example fix

// before
channel.basicPublish("", queue, propsWith("count", 42), body); // Integer header
// after
channel.basicPublish("", queue, propsWith("count", new LongStringHelper.LongString("42".getBytes(UTF_8))), body);
Defensive patterns

Strategy: type-guard

Validate before calling

// Check header value type before consuming
Object v = headers.get("myHeader");
if (!(v instanceof LongString)) { throw new IllegalArgumentException("header must be LongString, got " + v.getClass()); }

Type guard

boolean isSerializableHeader(Object v) { return v instanceof LongString; }

Try / catch

try { msg.getTransformedValue(key); } catch (RuntimeException | UnsupportedOperationException e) { log.warn("unsupported header type for key", e); /* skip header */ }

Prevention

When it happens

Trigger: A message published with headers whose values are not LongString (e.g. Integer, Boolean, Date, byte[], Map) and the reader calls serializableHeaders/getTransformedValue.

Common situations: Producers using AMQP field tables with typed values; framework-injected headers with numeric/boolean values; header encoding differences across client libraries.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/5315cf68a22699ab. Report an issue: GitHub.