FasterXML/jackson-databind · error · IllegalArgumentException

Module ( ) without defined version

Error message

Module ({}) without defined version

What it means

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.

Solutions

  1. Override version() in your JacksonModule to return a non-null Version (e.g. PackageVersion.VERSION or new Version(major, minor, patch, null, group, artifact)).
  2. Use SimpleModule's (name, version) constructor so the version field is populated.
  3. If the failing module is a dependency, fix the dependency or exclude it.

Example fix

// before
public class MyModule extends JacksonModule {
    @Override public String getModuleName() { return "MyModule"; }
    @Override public Version version() { return null; }
}

// after
public class MyModule extends JacksonModule {
    @Override public String getModuleName() { return "MyModule"; }
    @Override public Version version() { return PackageVersion.VERSION; }
}
Defensive patterns

Strategy: validation

Validate before calling

JacksonModule module = ...;
if (module.version() == null) {
    throw new IllegalStateException("Module missing version: " + module.getClass());
}
builder.addModule(module);

Prevention

When it happens

Trigger: Calling JsonMapper.builder().addModule(module) (or addModules, or via getDependencies() traversal) where module.version() == null.

Common situations: 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.

Related errors


AI-assisted analysis of FasterXML/jackson-databind@87876ca5c0 (2026-08-11). Data as JSON: /api/errors/b43a00bcfaedfa61. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/tools/jackson/databind/cfg/MapperBuilder.java:1139

    {
        _verifyModuleMetadata(module);
        final Object moduleId = module.getRegistrationId();
        if (_modules.containsKey(moduleId)) {
            return;
        }
        for (JacksonModule dep : module.getDependencies()) {
            _addDependency(dep);
        }
        _modules.put(moduleId, module);
    }

    private void _verifyModuleMetadata(JacksonModule module)
    {
        if (module.getModuleName() == null) {
            throw new IllegalArgumentException("Module ("+module.getClass().getName()+") without defined name");
        }
        if (module.version() == null) {
            throw new IllegalArgumentException("Module ("+module.getClass().getName()+") without defined version");
        }
    }

    public B addModules(JacksonModule... modules)
    {
        for (JacksonModule module : modules) {
            addModule(module);
        }
        return _this();
    }

    public B addModules(Iterable<? extends JacksonModule> modules)
    {
        for (JacksonModule module : modules) {
            addModule(module);
        }
        return _this();
    }

View on GitHub (pinned to 87876ca5c0)