{"record":{"id":"df281cda030727c9","repo":"FasterXML/jackson-databind","slug":"argument-s-is-null","errorCode":null,"errorMessage":"argument \"%s\" is null","messagePattern":"argument \"(.+?)\" is null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/tools/jackson/databind/ObjectReader.java","lineNumber":2115,"sourceCode":"    }\n\n    /**\n     * Internal helper method called to create an instance of {@link DeserializationContext}\n     * for deserializing a single root value.\n     * Can be overridden if a custom context is needed.\n     */\n    protected DeserializationContextExt _deserializationContext() {\n        return _contexts.createContext(_config, _schema, _injectableValues);\n    }\n\n    protected DeserializationContextExt _deserializationContext(JsonParser p) {\n        return _contexts.createContext(_config, _schema, _injectableValues)\n                .assignParser(p);\n    }\n\n    protected final void _assertNotNull(String paramName, Object src) {\n        if (src == null){\n            throw new IllegalArgumentException(\"argument \\\"%s\\\" is null\".formatted(paramName));\n        }\n    }\n\n    /*\n    /**********************************************************************\n    /* Helper methods, locating deserializers etc\n    /**********************************************************************\n     */\n\n    /**\n     * Method called to locate deserializer for the passed root-level value.\n     */\n    protected ValueDeserializer<Object> _findRootDeserializer(DeserializationContext ctxt)\n        throws DatabindException\n    {\n        if (_rootDeserializer != null) {\n            return _rootDeserializer;\n        }","sourceCodeStart":2097,"sourceCodeEnd":2133,"githubUrl":"https://github.com/FasterXML/jackson-databind/blob/87876ca5c0569b4933aec2d30d6225e4b9ba3a43/src/main/java/tools/jackson/databind/ObjectReader.java#L2097-L2133","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nString json = mightReturnNull();\nMyType result = reader.readValue(json); // throws if json is null\n// after\nString json = mightReturnNull();\nif (json == null) throw new IllegalStateException(\"source JSON was null\");\nMyType result = reader.readValue(json);","handlingStrategy":"validation","validationCode":"// Check for null before calling reader\nif (source == null) {\n    throw new IllegalArgumentException(\"source must not be null\");\n}\nreader.readValue(source);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["null-check","objectreader","argument-validation","api-contract"],"backgroundTag":null,"analyzedSha":"87876ca5c0569b4933aec2d30d6225e4b9ba3a43","analyzedAt":"2026-08-11T12:55:24.033Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}