Flink: ExceptionInChainedOperatorException: Could not forward element to next operator
org.apache.flink.streaming.runtime.tasks.ExceptionInChainedOperatorExceptionCould not forward element to next operatorAn operator chained after the current one threw while processing a record. Flink wraps the error, so the message itself says nothing about the cause: the real exception is the innermost "Caused by" in the stack trace.
Common causes
- A user function (map, flatMap, a UDF in SQL) threw on a particular record, for example a NullPointerException or a parse error.How to confirm: The last "Caused by" names your class and line; the failing record is often visible in the same trace.
- A sink or format in the chain failed, for example a JSON serializer or a connector write.How to confirm: The innermost exception comes from a connector or format package rather than your code.
How to fix it
Fix the innermost exception. For bad input data, validate or filter records before the failing operator, or route them to a side output.
To see which operator failed, disable chaining temporarily so each operator runs as its own task.
| Setting | Default | Note |
|---|---|---|
pipeline.operator-chaining.enabled | true |
Where the message comes from
ExceptionInChainedOperatorException.javainapache/flinkatrelease-2.3.0- Message checked in Flink 2.3.0