{"record":{"id":"b43a00bcfaedfa61","repo":"FasterXML/jackson-databind","slug":"module-without-defined-version","errorCode":null,"errorMessage":"Module ({}) without defined version","messagePattern":"Module \\((.+?)\\) without defined version","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/tools/jackson/databind/cfg/MapperBuilder.java","lineNumber":1139,"sourceCode":"    {\n        _verifyModuleMetadata(module);\n        final Object moduleId = module.getRegistrationId();\n        if (_modules.containsKey(moduleId)) {\n            return;\n        }\n        for (JacksonModule dep : module.getDependencies()) {\n            _addDependency(dep);\n        }\n        _modules.put(moduleId, module);\n    }\n\n    private void _verifyModuleMetadata(JacksonModule module)\n    {\n        if (module.getModuleName() == null) {\n            throw new IllegalArgumentException(\"Module (\"+module.getClass().getName()+\") without defined name\");\n        }\n        if (module.version() == null) {\n            throw new IllegalArgumentException(\"Module (\"+module.getClass().getName()+\") without defined version\");\n        }\n    }\n\n    public B addModules(JacksonModule... modules)\n    {\n        for (JacksonModule module : modules) {\n            addModule(module);\n        }\n        return _this();\n    }\n\n    public B addModules(Iterable<? extends JacksonModule> modules)\n    {\n        for (JacksonModule module : modules) {\n            addModule(module);\n        }\n        return _this();\n    }","sourceCodeStart":1121,"sourceCodeEnd":1157,"githubUrl":"https://github.com/FasterXML/jackson-databind/blob/87876ca5c0569b4933aec2d30d6225e4b9ba3a43/src/main/java/tools/jackson/databind/cfg/MapperBuilder.java#L1121-L1157","documentation":"Thrown by MapperBuilder._verifyModuleMetadata when a JacksonModule being added has version() returning null. Jackson requires every module to report a Version for logging, compatibility checks, and duplicate detection; a null version is rejected at add time for the module and any of its declared dependencies.","triggerScenarios":"Calling JsonMapper.builder().addModule(module) (or addModules, or via getDependencies() traversal) where module.version() == null.","commonSituations":"A custom JacksonModule subclass that overrides version() to return null, or inherits a default returning null; a module ported from 2.x where Version was supplied by the superclass constructor but the new subclass uses the no-arg form; an incompletely implemented SPI-provided module.","solutions":["Override version() in your JacksonModule to return a non-null Version (e.g. PackageVersion.VERSION or new Version(major, minor, patch, null, group, artifact)).","Use SimpleModule's (name, version) constructor so the version field is populated.","If the failing module is a dependency, fix the dependency or exclude it."],"exampleFix":"// before\npublic class MyModule extends JacksonModule {\n    @Override public String getModuleName() { return \"MyModule\"; }\n    @Override public Version version() { return null; }\n}\n\n// after\npublic class MyModule extends JacksonModule {\n    @Override public String getModuleName() { return \"MyModule\"; }\n    @Override public Version version() { return PackageVersion.VERSION; }\n}","handlingStrategy":"validation","validationCode":"JacksonModule module = ...;\nif (module.version() == null) {\n    throw new IllegalStateException(\"Module missing version: \" + module.getClass());\n}\nbuilder.addModule(module);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use PackageVersion.VERSION (or an explicit Version) in version().","Prefer the SimpleModule(name, version) constructor.","Unit-test module metadata before publishing a module."],"tags":["jackson","module","config","builder","metadata","version"],"backgroundTag":null,"analyzedSha":"87876ca5c0569b4933aec2d30d6225e4b9ba3a43","analyzedAt":"2026-08-11T12:55:24.033Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}