{"record":{"id":"aa5448cffe307e30","repo":"FasterXML/jackson-databind","slug":"cannot-pass-null-resolver","errorCode":null,"errorMessage":"Cannot pass null resolver","messagePattern":"Cannot pass null resolver","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/tools/jackson/databind/cfg/DeserializerFactoryConfig.java","lineNumber":145,"sourceCode":"        ValueDeserializerModifier[] all = ArrayBuilders.insertInListNoDup(_modifiers, modifier);\n        return new DeserializerFactoryConfig(_additionalDeserializers, _additionalKeyDeserializers,\n                all, _valueInstantiators);\n    }\n\n    /**\n     * Fluent/factory method used to construct a configuration object that\n     * has same configuration as this instance plus specified additional\n     * value instantiator provider object.\n     * Added instantiator provider has the highest priority (that is, it\n     * gets called before any already registered resolver).\n     *\n     * @param instantiators Object that can provide {@link tools.jackson.databind.deser.ValueInstantiator}s for\n     *    constructing POJO values during deserialization\n     */\n    public DeserializerFactoryConfig withValueInstantiators(ValueInstantiators instantiators)\n    {\n        if (instantiators == null) {\n            throw new IllegalArgumentException(\"Cannot pass null resolver\");\n        }\n        ValueInstantiators[] all = ArrayBuilders.insertInListNoDup(_valueInstantiators, instantiators);\n        return new DeserializerFactoryConfig(_additionalDeserializers, _additionalKeyDeserializers,\n                _modifiers, all);\n    }\n\n    public boolean hasDeserializers() { return _additionalDeserializers.length > 0; }\n\n    public boolean hasKeyDeserializers() { return _additionalKeyDeserializers.length > 0; }\n\n    public boolean hasDeserializerModifiers() { return _modifiers.length > 0; }\n\n    public boolean hasValueInstantiators() { return _valueInstantiators.length > 0; }\n\n    public Iterable<Deserializers> deserializers() {\n        return new ArrayIterator<Deserializers>(_additionalDeserializers);\n    }\n","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/FasterXML/jackson-databind/blob/87876ca5c0569b4933aec2d30d6225e4b9ba3a43/src/main/java/tools/jackson/databind/cfg/DeserializerFactoryConfig.java#L127-L163","documentation":"Thrown by DeserializerFactoryConfig.withValueInstantiators(ValueInstantiators) when the argument is null. ValueInstantiators hooks provide custom ValueInstantiator instances used to construct POJO values during deserialization; a null entry would corrupt the resolver chain, so Jackson rejects it immediately.","triggerScenarios":"Registering a null ValueInstantiators via DeserializerFactoryConfig.withValueInstantiators(null), or a Module.setupModule passing null when adding value instantiators to the factory config.","commonSituations":"A module that conditionally supplies a ValueInstantiators and forgets the null branch; DI wiring where the bean is missing; copy-paste from another factory method that left a null.","solutions":["Only call withValueInstantiators(instantiators) when instantiators != null.","If you want a no-op resolver, implement ValueInstantiators returning null from findValueInstantiator instead of passing null for the provider itself.","Verify the lookup/factory producing ValueInstantiators never returns null."],"exampleFix":"// before\nfactoryConfig.withValueInstantiators(resolveInstantiators());\n\n// after\nValueInstantiators vi = resolveInstantiators();\nif (vi != null) {\n    factoryConfig.withValueInstantiators(vi);\n}","handlingStrategy":"validation","validationCode":"ValueInstantiators vi = resolveInstantiators();\nif (vi == null) {\n    // skip\n} else {\n    factoryConfig.withValueInstantiators(vi);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard every ValueInstantiators registration with a null check.","Return a no-op ValueInstantiators instead of null from providers.","Verify DI lookups for ValueInstantiators beans cannot be null."],"tags":["jackson","deserialization","config","null-check","builder","value-instantiator"],"backgroundTag":null,"analyzedSha":"87876ca5c0569b4933aec2d30d6225e4b9ba3a43","analyzedAt":"2026-08-11T12:55:24.033Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}