FasterXML/jackson-databind · error · IllegalArgumentException

Cannot pass null property name

Error message

Cannot pass null property name

What it means

Thrown by BeanPropertyMap.findDefinition(String key) when a null property name is passed. This method performs construction-time lookups (no case-insensitive matching, no alias expansion) and explicitly guards against null keys with an IllegalArgumentException. It indicates internal or programmatic code that attempted to find a property definition using a null name.

Source

Thrown at src/main/java/tools/jackson/databind/deser/bean/BeanPropertyMap.java:419

    public SettableBeanProperty findDefinition(int index)
    {
        for (SettableBeanProperty prop : _propsInOrder) {
            if ((prop != null) && (index == prop.getPropertyIndex())) {
                return prop;
            }
        }
        return null;
    }

    /**
     * NOTE: does NOT do case-insensitive matching -- only to be used during construction
     * and never during deserialization process -- nor alias expansion.
     */
    public SettableBeanProperty findDefinition(String key)
    {
        if (key == null) {
            throw new IllegalArgumentException("Cannot pass null property name");
        }
        for (SettableBeanProperty prop : _propsInOrder) {
            if (key.equals(prop.getName())) {
                return prop;
            }
        }
        return null;
    }

    /*
    /**********************************************************************
    /* Std method overrides
    /**********************************************************************
     */

    @Override
    public String toString()
    {

View on GitHub (pinned to a50c7d2a1d)

Solutions

  1. Check for null before calling findDefinition in any custom code that uses BeanPropertyMap.
  2. Trace where the null property name originates — inspect @JsonProperty annotations and mixins on the target class.
  3. If iterating, filter out null names before lookup.
  4. Use findDefinition(int index) as an alternative if you have the property index instead of the name.

Example fix

// before
SettableBeanProperty prop = beanPropertyMap.findDefinition(name);
// after
SettableBeanProperty prop = (name != null) ? beanPropertyMap.findDefinition(name) : null;
Defensive patterns

Strategy: validation

Validate before calling

// Null-check before calling findDefinition
if (name != null) {
    SettableBeanProperty prop = beanPropertyMap.findDefinition(name);
}

Type guard

Objects.requireNonNull(name, "property name must not be null");
SettableBeanProperty prop = beanPropertyMap.findDefinition(name);

Try / catch

try {
    return map.findDefinition(key);
} catch (IllegalArgumentException e) {
    if (key == null) return null;
    throw e;
}

Prevention

When it happens

Trigger: Calling BeanPropertyMap.findDefinition(null) directly from custom deserializer or modifier code. A framework path where a property name resolves to null due to a missing @JsonProperty annotation or a misconfigured introspection result.

Common situations: Custom BeanDeserializerModifier or ValueInstantiator that iterates properties and passes a potentially null name. A class where introspection yields a property with a null name (rare, usually from misconfigured annotations or mixin).

Related errors


AI-assisted analysis of FasterXML/jackson-databind@a50c7d2a1d (2026-08-06). Data as JSON: /api/errors/a25c9a58a23ad66e. Report an issue: GitHub.