FasterXML/jackson-databind · error · DeferredBindingException

%d deserialization problems%s (showing first 5):%n%s

Error message

%d deserialization problems%s (showing first 5):%n%s

What it means

This is the user-facing message of a DeferredBindingException thrown by ObjectReader when using a problemCollectingReader() and multiple deserialization problems were collected during a single read operation. Rather than failing on the first error, the collecting reader buffers up to maxProblems errors and then throws this exception with a summary showing the total count, whether the limit was reached, and the first 5 problem messages with their paths.

Source

Thrown at src/main/java/tools/jackson/databind/ObjectReader.java:1933

        int maxProblems = CollectingProblemHandler.DEFAULT_MAX_PROBLEMS;
        LinkedNode<DeserializationProblemHandler> handlers = _config.getProblemHandlers();
        while (handlers != null) {
            if (handlers.value() instanceof CollectingProblemHandler cph) {
                maxProblems = cph.getMaxProblems();
                break;
            }
            handlers = handlers.next();
        }

        try {
            // Directly invoke _bind with the prepared context
            @SuppressWarnings("unchecked")
            T result = (T) _bind(ctxt, p, _valueToUpdate);

            // Check if any problems were collected
            if (!bucket.isEmpty()) {
                boolean limitReached = (bucket.size() >= maxProblems);
                throw new DeferredBindingException(p, bucket, limitReached);
            }

            return result;

        } catch (DeferredBindingException e) {
            throw e; // Already properly formatted

        } catch (DatabindException e) {
            // Hard failure occurred; attach collected problems as suppressed
            if (!bucket.isEmpty()) {
                boolean limitReached = (bucket.size() >= maxProblems);
                if (limitReached) {
                    // Limit was hit - throw DeferredBindingException as primary exception
                    DeferredBindingException dbe = new DeferredBindingException(p, bucket, true);
                    dbe.addSuppressed(e); // Original error as suppressed for debugging
                    throw dbe;
                } else {
                    // Hard failure unrelated to limit - keep original as primary

View on GitHub (pinned to 87876ca5c0)

Solutions

  1. Inspect DeferredBindingException.getProblems() to get the full structured list of CollectedProblem objects, not just the message string.
  2. Fix the underlying input data issues identified by each problem's path and message.
  3. Increase maxProblems via problemCollectingReader(largerValue) if you need to see more than the current limit.
  4. If you need to process partially-valid data, use a tree model (readTree) and validate field-by-field with error tolerance instead of direct POJO binding.

Example fix

// before: only see message
try {
    reader.readValue(json, MyType.class);
} catch (DeferredBindingException e) {
    log.error(e.getMessage()); // only first 5 in text
}
// after: inspect all problems programmatically
try {
    reader.readValue(json, MyType.class);
} catch (DeferredBindingException e) {
    for (CollectedProblem p : e.getProblems()) {
        log.warn("{}: {}", p.getPath(), p.getMessage());
    }
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
    MyType result = collectingReader.readValue(json, MyType.class);
} catch (DeferredBindingException e) {
    List<CollectedProblem> problems = e.getProblems();
    // report all problems to the caller, log them, or collect for batch retry
    for (CollectedProblem p : problems) {
        response.addFieldError(p.getPath(), p.getMessage());
    }
}

Prevention

When it happens

Trigger: Calling readValue() on an ObjectReader obtained via problemCollectingReader() / problemCollectingReader(int) on JSON input that contains multiple field-level deserialization errors (wrong types, missing required fields, bad formats). The exception message is generated in DeferredBindingException.formatMessage() and the throw happens at ObjectReader._bindWithProblemCollection():1933.

Common situations: Bulk-importing JSON data where you want to see all validation errors at once rather than fixing them one at a time. API request validation where you want to report all field errors to the caller. Processing user-uploaded data files with expected format issues.

Related errors


AI-assisted analysis of FasterXML/jackson-databind@87876ca5c0 (2026-08-11). Data as JSON: /api/errors/6556bd89d8b2347e. Report an issue: GitHub.