{"record":{"id":"464542db21e3f2d2","repo":"quarkusio/quarkus","slug":"only-supported-major-versions-are-0-and-1","errorCode":null,"errorMessage":"Only supported major versions are 0 and 1.","messagePattern":"Only supported major versions are 0 and 1\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/knative/events/CloudEventBuilder.java","lineNumber":26,"sourceCode":"    private String specVersion;\n    private String id;\n    private String type;\n    private String source;\n    private String subject;\n    private OffsetDateTime time;\n    private String dataSchema;\n    private Map<String, String> extensions;\n\n    private CloudEventBuilder() {\n    }\n\n    public static CloudEventBuilder create() {\n        return new CloudEventBuilder();\n    }\n\n    public CloudEventBuilder specVersion(String specVersion) {\n        if ((specVersion.charAt(0) != '0' && specVersion.charAt(0) != '1') || specVersion.charAt(1) != '.') {\n            throw new IllegalArgumentException(\"Only supported major versions are 0 and 1.\");\n        }\n        this.specVersion = specVersion;\n        return this;\n    }\n\n    public CloudEventBuilder id(String id) {\n        this.id = id;\n        return this;\n    }\n\n    public CloudEventBuilder type(String type) {\n        this.type = type;\n        return this;\n    }\n\n    public CloudEventBuilder source(String source) {\n        this.source = source;\n        return this;","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/knative/events/CloudEventBuilder.java#L8-L44","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nCloudEventBuilder.create().specVersion(\"v1.0\");\n// after\nCloudEventBuilder.create().specVersion(\"1.0\");","handlingStrategy":"validation","validationCode":"boolean validSpecVersion(String v) { return v != null && v.length() >= 2 && (v.charAt(0)=='0'||v.charAt(0)=='1') && v.charAt(1)=='.'; }\nif (!validSpecVersion(ver)) throw new IllegalArgumentException(\"Use 0.x or 1.x\");","typeGuard":"java.util.regex.Pattern CE_SPEC = Pattern.compile(\"^[01]\\\\.[0-9]+$\");\nboolean isSupportedSpec(String v) { return v != null && CE_SPEC.matcher(v).matches(); }","tryCatchPattern":"try { builder.specVersion(ver); } catch (IllegalArgumentException e) { log.warn(\"Unsupported ce-specversion: \" + ver + \", defaulting to 1.0\"); builder.specVersion(\"1.0\"); }","preventionTips":["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"],"tags":["knative","cloudevent","spec-version","funqy"],"backgroundTag":"unsupported-spec-version","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}