FasterXML/jackson-databind · error · IllegalArgumentException
argument " " is null
Error message
argument "%s" is null
What it means
Thrown by ObjectReader._assertNotNull() when a required non-null argument is passed as null to a public ObjectReader method. This is a fast-fail guard at the API boundary to prevent NullPointerException deeper in the deserialization pipeline where the cause would be unclear.
Solutions
- Initialize the source variable before calling the reader method.
- Add a null check in your code before calling: if (input != null) reader.readValue(input).
- Use Objects.requireNonNull(input, "input") for a clearer error at the call site.
Example fix
// before
String json = mightReturnNull();
MyType result = reader.readValue(json); // throws if json is null
// after
String json = mightReturnNull();
if (json == null) throw new IllegalStateException("source JSON was null");
MyType result = reader.readValue(json); Defensive patterns
Strategy: validation
Validate before calling
// Check for null before calling reader
if (source == null) {
throw new IllegalArgumentException("source must not be null");
}
reader.readValue(source); Prevention
- Use Objects.requireNonNull(param, "paramName") at the call site for clearer errors.
- Initialize all source variables before calling reader methods.
- Avoid Optional.orElse(null) patterns feeding into reader calls.
When it happens
Trigger: Calling ObjectReader methods like readValue((JsonParser) null), with((InputStream) null), or similar where the internal _assertNotNull check guards the parameter. The paramName in the message identifies which parameter was null.
Common situations: Passing a null InputStream, Reader, File, byte[], or String to readValue/forX methods. Forgetting to initialize a variable before passing it. Conditional code paths that may leave a variable null.
Related errors
- argument " " is null
- maxProblems must be positive
- Cannot pass null Deserializers
- Cannot pass null KeyDeserializers
- Cannot pass null modifier
AI-assisted analysis of FasterXML/jackson-databind@87876ca5c0 (2026-08-11).
Data as JSON: /api/errors/df281cda030727c9.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/tools/jackson/databind/ObjectReader.java:2115
}
/**
* Internal helper method called to create an instance of {@link DeserializationContext}
* for deserializing a single root value.
* Can be overridden if a custom context is needed.
*/
protected DeserializationContextExt _deserializationContext() {
return _contexts.createContext(_config, _schema, _injectableValues);
}
protected DeserializationContextExt _deserializationContext(JsonParser p) {
return _contexts.createContext(_config, _schema, _injectableValues)
.assignParser(p);
}
protected final void _assertNotNull(String paramName, Object src) {
if (src == null){
throw new IllegalArgumentException("argument \"%s\" is null".formatted(paramName));
}
}
/*
/**********************************************************************
/* Helper methods, locating deserializers etc
/**********************************************************************
*/
/**
* Method called to locate deserializer for the passed root-level value.
*/
protected ValueDeserializer<Object> _findRootDeserializer(DeserializationContext ctxt)
throws DatabindException
{
if (_rootDeserializer != null) {
return _rootDeserializer;
}View on GitHub (pinned to 87876ca5c0)