quarkusio/quarkus · error · IllegalArgumentException
Only supported major versions are 0 and 1.
Error message
Only supported major versions are 0 and 1.
What it means
CloudEventBuilder.specVersion(String) validates the spec version string. Only major versions 0.x and 1.x are supported (per the CloudEvents spec); anything else (e.g. '2.0', 'abc', missing dot) throws IllegalArgumentException.
Source
Thrown at extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/knative/events/CloudEventBuilder.java:26
private String specVersion;
private String id;
private String type;
private String source;
private String subject;
private OffsetDateTime time;
private String dataSchema;
private Map<String, String> extensions;
private CloudEventBuilder() {
}
public static CloudEventBuilder create() {
return new CloudEventBuilder();
}
public CloudEventBuilder specVersion(String specVersion) {
if ((specVersion.charAt(0) != '0' && specVersion.charAt(0) != '1') || specVersion.charAt(1) != '.') {
throw new IllegalArgumentException("Only supported major versions are 0 and 1.");
}
this.specVersion = specVersion;
return this;
}
public CloudEventBuilder id(String id) {
this.id = id;
return this;
}
public CloudEventBuilder type(String type) {
this.type = type;
return this;
}
public CloudEventBuilder source(String source) {
this.source = source;
return this;View on GitHub (pinned to e1c734241f)
Solutions
- Use specVersion("1.0") (or "0.3" etc.) instead of the unsupported value.
- Strip a leading 'v' prefix from the version string before passing it.
- Upgrade the Quarkus Funqy extension if a newer CloudEvents spec version must be supported.
- Validate/normalize incoming ce-specversion headers before dispatch.
Example fix
// before
CloudEventBuilder.create().specVersion("v1.0");
// after
CloudEventBuilder.create().specVersion("1.0"); Defensive patterns
Strategy: validation
Validate before calling
boolean validSpecVersion(String v) { return v != null && v.length() >= 2 && (v.charAt(0)=='0'||v.charAt(0)=='1') && v.charAt(1)=='.'; }
if (!validSpecVersion(ver)) throw new IllegalArgumentException("Use 0.x or 1.x"); Type guard
java.util.regex.Pattern CE_SPEC = Pattern.compile("^[01]\\.[0-9]+$");
boolean isSupportedSpec(String v) { return v != null && CE_SPEC.matcher(v).matches(); } Try / catch
try { builder.specVersion(ver); } catch (IllegalArgumentException e) { log.warn("Unsupported ce-specversion: " + ver + ", defaulting to 1.0"); builder.specVersion("1.0"); } Prevention
- Always use "1.0" for new events
- Strip leading 'v' prefixes from external version strings
- Validate ce-specversion headers at the edge before dispatch
- Pin event producers to CloudEvents 1.0
When it happens
Trigger: Calling CloudEventBuilder.create().specVersion("...") with a string whose first char is not '0'/'1' or whose second char is not '.'; also triggered when an incoming Knative event header ce-specversion contains an unsupported value.
Common situations: Experimenting with a future CloudEvents spec version (e.g. 2.0), a typo like "1" or "v1.0", or an event source emitting an unsupported specversion header.
Related errors
- Don't know how to get event data (dataContentType: '%s', jav
- Cannot deserialize data for data-content-encoding: '${dataCo
- Don't know how to get event data (dataContentType: '%s', jav
- 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/464542db21e3f2d2.
Report an issue: GitHub.