{"record":{"id":"8ced48d203ffbf85","repo":"testcontainers/testcontainers-java","slug":"extension-id-must-not-be-null-or-empty","errorCode":null,"errorMessage":"extension id must not be null or empty","messagePattern":"extension id must not be null or empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQExtension.java","lineNumber":202,"sourceCode":"        private int priority = 0;\n\n        private int startPriority = 0;\n\n        private boolean disabledOnStartup = false;\n\n        @Nullable\n        private Class<?> mainClass;\n\n        @NotNull\n        private final LinkedList<Class<?>> additionalClasses = new LinkedList<>();\n\n        /**\n         * Builds the {@link HiveMQExtension} with the provided values or default values.\n         * @return the HiveMQ Extension\n         */\n        public @NotNull HiveMQExtension build() {\n            if (id == null || id.isEmpty()) {\n                throw new IllegalArgumentException(\"extension id must not be null or empty\");\n            }\n            if (name == null || name.isEmpty()) {\n                throw new IllegalArgumentException(\"extension name must not be null or empty\");\n            }\n            if (version == null || version.isEmpty()) {\n                throw new IllegalArgumentException(\"extension version must not be null or empty\");\n            }\n            if (mainClass == null) {\n                throw new IllegalArgumentException(\"extension main class must not be null\");\n            }\n            return new HiveMQExtension(\n                id,\n                name,\n                version,\n                priority,\n                startPriority,\n                disabledOnStartup,\n                mainClass,","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQExtension.java#L184-L220","documentation":"HiveMQExtension.Builder.build() validates that id, name, and version are all non-null and non-empty before constructing the HiveMQExtension. An absent or empty id fails first with this IllegalArgumentException. These fields are mandatory because they populate hivemq-extension.xml and the extension identity used by the broker.","triggerScenarios":"Calling HiveMQExtension.builder()...build() without .id(\"...\") or with id(\"\") — e.g. id supplied from an empty variable/config.","commonSituations":"Copy-pasted builder omitting the id call; id read from an environment variable or system property that is unset; refactor renaming constants so the id call was dropped.","solutions":["Add .id(\"your-extension-id\") to the builder chain.","If the id comes from a variable, check it is non-null/non-empty before building.","Verify the builder chain actually targets the HiveMQExtension.Builder (a generic Builder import can hide the missing call)."],"exampleFix":"// before\nHiveMQExtension ext = HiveMQExtension.builder()\n    .name(\"My Extension\").version(\"1.0.0\").build();\n// after\nHiveMQExtension ext = HiveMQExtension.builder()\n    .id(\"my-extension\")\n    .name(\"My Extension\").version(\"1.0.0\").build();","handlingStrategy":"validation","validationCode":"if (extId == null || extId.isBlank()) throw new IllegalArgumentException(\"extension id must be provided\");\n// then: builder.id(extId)","typeGuard":null,"tryCatchPattern":"try { ext = HiveMQExtension.builder()...build(); } catch (IllegalArgumentException e) { log.error(\"Invalid extension definition: {}\", e.getMessage()); throw e; }","preventionTips":["Always set id, name, and version in the builder — all three are mandatory.","Load ids from constants, not optional env vars, in test fixtures.","Review builder chains after refactors to ensure no mandatory call was dropped."],"tags":["hivemq","missing-argument","builder","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}