{"record":{"id":"a25c9a58a23ad66e","repo":"FasterXML/jackson-databind","slug":"cannot-pass-null-property-name","errorCode":null,"errorMessage":"Cannot pass null property name","messagePattern":"Cannot pass null property name","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/tools/jackson/databind/deser/bean/BeanPropertyMap.java","lineNumber":419,"sourceCode":"\n    public SettableBeanProperty findDefinition(int index)\n    {\n        for (SettableBeanProperty prop : _propsInOrder) {\n            if ((prop != null) && (index == prop.getPropertyIndex())) {\n                return prop;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * NOTE: does NOT do case-insensitive matching -- only to be used during construction\n     * and never during deserialization process -- nor alias expansion.\n     */\n    public SettableBeanProperty findDefinition(String key)\n    {\n        if (key == null) {\n            throw new IllegalArgumentException(\"Cannot pass null property name\");\n        }\n        for (SettableBeanProperty prop : _propsInOrder) {\n            if (key.equals(prop.getName())) {\n                return prop;\n            }\n        }\n        return null;\n    }\n\n    /*\n    /**********************************************************************\n    /* Std method overrides\n    /**********************************************************************\n     */\n\n    @Override\n    public String toString()\n    {","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/FasterXML/jackson-databind/blob/a50c7d2a1d57234ac4adf70dbd88ac90db6436e4/src/main/java/tools/jackson/databind/deser/bean/BeanPropertyMap.java#L401-L437","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Check for null before calling findDefinition in any custom code that uses BeanPropertyMap.","Trace where the null property name originates — inspect @JsonProperty annotations and mixins on the target class.","If iterating, filter out null names before lookup.","Use findDefinition(int index) as an alternative if you have the property index instead of the name."],"exampleFix":"// before\nSettableBeanProperty prop = beanPropertyMap.findDefinition(name);\n// after\nSettableBeanProperty prop = (name != null) ? beanPropertyMap.findDefinition(name) : null;","handlingStrategy":"validation","validationCode":"// Null-check before calling findDefinition\nif (name != null) {\n    SettableBeanProperty prop = beanPropertyMap.findDefinition(name);\n}","typeGuard":"Objects.requireNonNull(name, \"property name must not be null\");\nSettableBeanProperty prop = beanPropertyMap.findDefinition(name);","tryCatchPattern":"try {\n    return map.findDefinition(key);\n} catch (IllegalArgumentException e) {\n    if (key == null) return null;\n    throw e;\n}","preventionTips":["Always null-check property names before calling BeanPropertyMap methods.","Validate annotation-driven names during introspection setup.","Use Optional.ofNullable(name).map(map::findDefinition).orElse(null) for safety."],"tags":["jackson","deserialization","null-argument","bean-property-map"],"analyzedSha":"a50c7d2a1d57234ac4adf70dbd88ac90db6436e4","analyzedAt":"2026-08-06T20:31:51.404Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}