{"record":{"id":"7ee6d0ee721ce498","repo":"eclipse-vertx/vert.x","slug":"ioe-getmessage","errorCode":null,"errorMessage":"${ioe.getMessage()}","messagePattern":"\\$\\{ioe\\.getMessage\\(\\)\\}","errorType":"exception","errorClass":"DecodeException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/parsetools/impl/JsonParserImpl.java","lineNumber":336,"sourceCode":"          throw e;\n        }\n      } finally {\n        emitting = false;\n      }\n    }\n  }\n\n  private void checkExceptions() {\n    List<IOException> exceptions = collectedExceptions;\n    collectedExceptions = null;\n    if (exceptions != null && exceptions.size() > 0) {\n      if (exceptionHandler != null) {\n        for (IOException ioe : exceptions) {\n          exceptionHandler.handle(ioe);\n        }\n      } else {\n        IOException ioe = exceptions.get(0);\n        throw new DecodeException(ioe.getMessage(), ioe);\n      }\n    }\n  }\n\n  @Override\n  public JsonParser objectEventMode() {\n    objectValueMode = false;\n    return this;\n  }\n\n  @Override\n  public JsonParser objectValueMode() {\n    objectValueMode = true;\n    return this;\n  }\n\n  @Override\n  public JsonParser arrayEventMode() {","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/parsetools/impl/JsonParserImpl.java#L318-L354","documentation":"During parsing, Jackson may report IOExceptions (e.g. malformed JSON detected in non-blocking mode). JsonParserImpl collects them; if the user registered an exceptionHandler they are delivered there, otherwise the first exception is rethrown as a DecodeException wrapping the IOException message. It indicates the JSON stream being parsed is malformed or truncated.","triggerScenarios":"Feeding invalid/truncated JSON to the parser without setting exceptionHandler(); parsing completes (end() or a buffer handler) and checkExceptions() fires the accumulated DecodeException.","commonSituations":"Upstream services sending malformed NDJSON; network truncation of a JSON body; parsing a stream that mixes JSON with non-JSON framing bytes.","solutions":["Fix the source data to be valid JSON; validate payloads upstream","Register parser.exceptionHandler(ioe -> ...) to handle malformed data gracefully instead of an unhandled DecodeException","Inspect the DecodeException cause (IOException) and its message for the parser position of the malformed input"],"exampleFix":"// before\nparser.handler(event -> handle(event));\nstream.pipeTo(parser); // DecodeException on malformed input\n// after\nparser.exceptionHandler(ioe -> log.warn(\"Malformed JSON: {}\", ioe.getMessage()));\nparser.handler(event -> handle(event));\nstream.pipeTo(parser);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"parser.exceptionHandler(ioe -> {\n  // handle malformed JSON without throwing\n});\n// and/or around consuming:\ntry {\n  parser.end();\n} catch (DecodeException e) {\n  // e.getCause() is the underlying IOException with position details\n}","preventionTips":["Always register an exceptionHandler on JsonParser for streaming input","Validate/repair upstream JSON (NDJSON framing, charset) before parsing","Log DecodeException causes to capture the parser error position"],"tags":["vertx","json-parser","decode-exception","malformed-json"],"backgroundTag":"json-parse-error","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}