quarkusio/quarkus · error · RuntimeException
Don't know how to get event data (dataContentType: '%s', jav
Error message
Don't know how to get event data (dataContentType: '%s', javaType: '%s').
What it means
Same family as error 793 but in JsonCloudEventImpl: after trying JSON deserialization paths, if the requested dataType cannot be produced from the event JSON (unsupported combination of dataContentType and Java type), it throws this RuntimeException.
Source
Thrown at extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/JsonCloudEventImpl.java:229
if (event.has("data")) {
data = (T) mapper.writeValueAsBytes(event.get("data"));
return data;
} else if (event.has("data_base64")) {
String txt = event.get("data_base64").asText();
data = (T) Base64.getDecoder().decode(txt);
return data;
} else {
return null;
}
}
} catch (JacksonException e) {
throw new RuntimeException(e);
}
} else {
String msg = String.format("Don't know how to get event data (dataContentType: '%s', javaType: '%s').",
dataContentType(), dataType.getTypeName());
throw new RuntimeException(msg);
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Declare the function input as String or byte[] and deserialize manually.
- Set the event's Content-Type to application/json so Jackson can map it to the POJO.
- Add a Jackson @JsonDeserialize mapping/default constructor to the target type.
- Align the function's input type with the actual event payload type.
Example fix
// before MyPojo p = event.data(MyPojo.class); // content-type: text/plain // after byte[] raw = event.data(byte[].class); MyPojo p = MAPPER.readValue(raw, MyPojo.class);
Defensive patterns
Strategy: validation
Validate before calling
if (!"application/json".equals(event.dataContentType()) && !isSimpleType(dataType)) {
throw new IllegalArgumentException("JSON event data requires application/json or String/byte[] target");
} Type guard
boolean jsonDataTypeSupported(String contentType, Class<?> t) {
return "application/json".equals(contentType) || t == String.class || t == byte[].class;
} Try / catch
try { return event.data(dataType); } catch (RuntimeException e) { if (e.getMessage().startsWith("Don't know how to get event data")) { byte[] raw = event.data(byte[].class); return MAPPER.readValue(raw, dataType); } throw e; } Prevention
- Match the function input type to the event's ce-datacontenttype
- Use application/json for structured POJO payloads
- Give POJOs default constructors and Jackson annotations
- Fall back to byte[] + manual deserialization for exotic content types
When it happens
Trigger: Calling data(SomeUnsupportedType.class) on a JsonCloudEventImpl where the content type is not JSON-mappable to the target type (e.g. text/plain content with a POJO target, or a complex type with no Jackson mapping).
Common situations: Function signature declares a POJO but the event's ce-datacontenttype is text/plain or absent; target type lacks a default constructor/Jackson mapping; binary content requested as a structured type.
Related errors
- Don't know how to get event data (dataContentType: '%s', jav
- Cannot deserialize data for data-content-encoding: '${dataCo
- Only supported major versions are 0 and 1.
- Function for trigger '${trigger}' has multiple matching invo
- When using CloudEvent<> generic parameter must be used.
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/86663d0464f6315b.
Report an issue: GitHub.