{"record":{"id":"8b389f41ec9b142b","repo":"FasterXML/jackson-databind","slug":"module-without-defined-name","errorCode":null,"errorMessage":"Module ({}) without defined name","messagePattern":"Module \\((.+?)\\) without defined name","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/tools/jackson/databind/cfg/MapperBuilder.java","lineNumber":1136,"sourceCode":"    }\n\n    private void _addDependency(JacksonModule module)\n    {\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);","sourceCodeStart":1118,"sourceCodeEnd":1154,"githubUrl":"https://github.com/FasterXML/jackson-databind/blob/87876ca5c0569b4933aec2d30d6225e4b9ba3a43/src/main/java/tools/jackson/databind/cfg/MapperBuilder.java#L1118-L1154","documentation":"Thrown by MapperBuilder._verifyModuleMetadata when a JacksonModule being added has getModuleName() returning null. Every module must declare a non-null name (alongside a version) so Jackson can register, de-duplicate, and report it; a null name breaks module identity and is rejected when the module or any of its dependencies is added.","triggerScenarios":"Calling JsonMapper.builder().addModule(module) (or addModules / module dependency resolution) where module.getModuleName() == null. Triggered for the module itself and recursively for any module returned by getDependencies().","commonSituations":"Hand-writing a JacksonModule subclass and forgetting to override getModuleName(); porting a 2.x module where the name was set via the SimpleModule constructor but the new subclass drops it; a third-party/SPI-loaded module (ServiceLoader) that is incomplete.","solutions":["Override getModuleName() in your JacksonModule to return a stable non-null String (typically the module's symbolic name).","Prefer constructing SimpleModule with the (name, version) constructor which sets both fields, instead of subclassing JacksonModule directly.","If the failing module is a dependency (getDependencies()), fix or exclude that dependency module."],"exampleFix":"// before\npublic class MyModule extends JacksonModule {\n    @Override public Version version() { return PackageVersion.VERSION; }\n    // getModuleName() missing -> returns 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.getModuleName() == null || module.version() == null) {\n    throw new IllegalStateException(\"Module missing name/version: \" + module.getClass());\n}\nbuilder.addModule(module);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set both name and version when constructing SimpleModule.","Override getModuleName() and version() together in custom JacksonModule subclasses.","Add a unit test that builds a mapper with your module to catch missing metadata early."],"tags":["jackson","module","config","builder","metadata"],"backgroundTag":null,"analyzedSha":"87876ca5c0569b4933aec2d30d6225e4b9ba3a43","analyzedAt":"2026-08-11T12:55:24.033Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}