{"record":{"id":"7457c07e8f3fc5f7","repo":"quarkusio/quarkus","slug":"extension-name-cannot-be-null","errorCode":null,"errorMessage":"Extension name cannot be null","messagePattern":"Extension name cannot be null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/funqy/funqy-amazon-lambda/runtime/src/main/java/io/quarkus/funqy/lambda/model/cloudevents/CloudEventV1.java","lineNumber":163,"sourceCode":"    public Object getAttribute(final String attributeName) throws IllegalArgumentException {\n        return switch (attributeName) {\n            case \"specversion\" -> getSpecVersion();\n            case \"id\" -> getId();\n            case \"source\" -> getSource();\n            case \"type\" -> getType();\n            case \"datacontenttype\" -> getDataContentType();\n            case \"dataschema\" -> getDataSchema();\n            case \"subject\" -> getSubject();\n            case \"time\" -> getTime();\n            default -> throw new IllegalArgumentException(\n                    \"The specified attribute name \\\"\" + attributeName + \"\\\" is not specified in version v1.\");\n        };\n    }\n\n    @Override\n    public Object getExtension(final String s) {\n        if (s == null) {\n            throw new IllegalArgumentException(\"Extension name cannot be null\");\n        }\n        return this.extensions.get(s);\n    }\n\n    @Override\n    public Set<String> getExtensionNames() {\n        return this.extensions.keySet();\n    }\n}\n","sourceCodeStart":145,"sourceCodeEnd":173,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/funqy/funqy-amazon-lambda/runtime/src/main/java/io/quarkus/funqy/lambda/model/cloudevents/CloudEventV1.java#L145-L173","documentation":"Thrown by CloudEventV1.getAttribute for any attribute name other than the standard CloudEvents V1 attributes (specversion, id, source, type, datacontenttype, dataschema, subject, time) — the switch's default branch. This record's message ('Extension name cannot be null') comes from the getExtension path: the given name is treated as a CloudEvents extension attribute, and the registry of extension name/value pairs has no entry (null extension name) for it, so the lookup rejects the unknown attribute.","triggerScenarios":"Calling getExtension(null), e.g. when the extension name comes from an unset config value, a missing header, or an unvalidated map key.","commonSituations":"Dynamically reading CloudEvent extension attributes from request headers where the header is absent; passing a variable that was never initialized.","solutions":["Check for null (and blank) before calling getExtension","Provide a default extension name when the source is optional"],"exampleFix":"// before\nObject ext = event.getExtension(configExtName); // may be null\n// after\nObject ext = configExtName == null ? null : event.getExtension(configExtName);","handlingStrategy":"validation","validationCode":"if (extensionName != null && !extensionName.isBlank()) {\n    value = event.getExtension(extensionName);\n}","typeGuard":"boolean isValidExtensionName(String s) {\n    return s != null && !s.isBlank();\n}","tryCatchPattern":"try {\n    value = event.getExtension(name);\n} catch (IllegalArgumentException e) {\n    value = null;\n}","preventionTips":["Null-check names sourced from headers/config before lookup","Default optional extension names","Never pass raw unvalidated map keys"],"tags":["cloudevents","funqy","null-check"],"backgroundTag":"null-argument","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"}