apache/flink · error · UnsupportedOperationException

Unsupported type of sink, please use DataStreamV2SinkUtils t

Error message

Unsupported type of sink, please use DataStreamV2SinkUtils to wrap a sink-v2 sink first.

What it means

Error "Unsupported type of sink, please use DataStreamV2SinkUtils to wrap a sink-v2 sink first." thrown in apache/flink.

Source

Thrown at flink-datastream/src/main/java/org/apache/flink/datastream/impl/utils/StreamUtils.java:545

                        stateDesc,
                        internalWindowFunction.getAllowedLateness());
        return StreamUtils.getOneInputKeyedTransformation(
                "TwoOutput-Window",
                inputStream,
                outType1,
                windowProcessOperator,
                keySelector,
                keyType);
    }

    /** Add sink operator to the input stream. */
    public static <T> DataStreamV2SinkTransformation<T, T> addSinkOperator(
            AbstractDataStream<T> inputStream, Sink<T> sink, TypeInformation<T> typeInformation) {
        // read the output type of the input Transform to coax out errors about MissingTypeInfo
        inputStream.getTransformation().getOutputType();

        if (!(sink instanceof WrappedSink)) {
            throw new UnsupportedOperationException(
                    "Unsupported type of sink, please use DataStreamV2SinkUtils to wrap a sink-v2 sink first.");
        }

        org.apache.flink.api.connector.sink2.Sink<T> innerSink =
                ((WrappedSink<T>) sink).getWrappedSink();

        DataStreamV2SinkTransformation<T, T> sinkTransformation =
                new DataStreamV2SinkTransformation<>(
                        inputStream,
                        innerSink,
                        typeInformation,
                        "Sink",
                        inputStream.getEnvironment().getParallelism(),
                        false);
        inputStream.getEnvironment().addOperator(sinkTransformation);
        return sinkTransformation;
    }

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Address the cause reported by the error message: Unsupported type of sink, please use DataStreamV2SinkUtils to wrap a sink-v2 sink first.
  2. Verify the inputs, configuration values, and classpath/dependency setup related to this operation, then retry.

Example fix

Correct the condition described ("Unsupported type of sink, please use DataStreamV2SinkUtils to wrap a sink-v2 sink first.") and rerun the job or command.

When it happens

Trigger: Triggered at runtime when the operation fails because: Unsupported type of sink, please use DataStreamV2SinkUtils to wrap a sink-v2 sink first.

Common situations: Commonly caused by misconfiguration, missing dependencies or files, unsupported types or operations, or invalid user input leading to: Unsupported type of sink, please use DataStreamV2SinkUtils to wrap a sink-v2 sink first.


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/beb12a3172587086. Report an issue: GitHub.