{"record":{"id":"6a157b432b197ab3","repo":"testcontainers/testcontainers-java","slug":"extension-version-must-not-be-null-or-empty","errorCode":null,"errorMessage":"extension version must not be null or empty","messagePattern":"extension version 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":208,"sourceCode":"        @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,\n                additionalClasses\n            );\n        }\n\n        /**\n         * Sets the identifier of the {@link HiveMQExtension}.","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQExtension.java#L190-L226","documentation":"Builder validation in HiveMQExtension.build: after checking the extension id, it validates that the extension name is non-null and non-empty, otherwise IllegalArgumentException is thrown. The at-fault input is a builder whose name was never set or set to an empty string.","triggerScenarios":"Calling build() without version(...), or version(null)/version(\"\").","commonSituations":"Generating the extension descriptor from build metadata where the project version is not yet resolved (e.g. missing version in Gradle/Maven config); template code with version left blank.","solutions":["Call .version(\"1.0.0\") with a concrete version string before build()","Ensure your build tool injects the project version into the builder call","Assert all required builder fields (id, name, version, mainClass) are populated in tests"],"exampleFix":"// before\nbuilder.id(\"ext\").name(\"my-extension\").build();\n// after\nbuilder.id(\"ext\").name(\"my-extension\").version(\"1.0.0\").build();","handlingStrategy":"validation","validationCode":"if (version == null || version.isEmpty()) throw new IllegalStateException(\"Set builder.version() before build()\");","typeGuard":"boolean hasVersion = version != null && !version.isBlank();","tryCatchPattern":null,"preventionTips":["Inject the project version from your build tool into the builder","Add a shared factory that fills in all required builder fields"],"tags":["hivemq","builder-validation","null-argument"],"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"}