<@U04S8PLJWMT> we keep getting `java.lang.IllegalS...
# ask-ai
s
@kapa.ai we keep getting
java.lang.IllegalStateException: Sync completed, but unflushed states were detected.
for a connection sync from MSSQL to ClickHouse V2
k
I'm sorry, but the provided knowledge sources do not contain any explicit information about the error message
java.lang.IllegalStateException: Sync completed, but unflushed states were detected.
in the context of syncing from MSSQL to ClickHouse V2. While there are several issues and discussions related to state handling, CDC syncs, and ClickHouse V2, none of them directly mention this specific error or provide a clear resolution or root cause for it. If you have additional logs or context, or if you can share more details about your Airbyte version and connector versions, it may help narrow down the issue. Otherwise, I recommend opening a new issue on the Airbyte GitHub repository or reaching out on the Airbyte community channels for more targeted support.
s
@kapa.ai part of the stacktrace:
Copy code
2025-11-18 17:12:30 destination INFO pool-2-thread-1 i.a.c.l.d.i.JsonDestinationMessageInputFlow(collect):51 Finished reading input.
2025-11-18 17:12:30 destination INFO pool-2-thread-1 i.a.c.l.d.i.DataFlowPipelineInputFlow(collect):58 Finished routing input.
2025-11-18 17:12:30 destination INFO DefaultDispatcher-worker-1 i.a.c.l.d.p.PipelineCompletionHandler$apply$2(invokeSuspend):31 Flushing 1 final aggregates...
2025-11-18 17:12:30 destination INFO DefaultDispatcher-worker-2 i.a.i.d.c.w.l.BinaryRowInsertBuffer(flush):59 Beginning insert into Response
2025-11-18 17:12:31 destination INFO DefaultDispatcher-worker-2 i.a.i.d.c.w.l.BinaryRowInsertBuffer(flush):70 Finished insert of 30 rows into Response
2025-11-18 17:12:31 destination INFO DefaultDispatcher-worker-2 i.a.c.l.d.p.PipelineCompletionHandler$apply$2(invokeSuspend):46 Final aggregates flushed.
2025-11-18 17:12:31 destination INFO main i.a.c.l.d.p.PipelineRunner(run):47 Individual pipelines complete...
2025-11-18 17:12:31 destination INFO main i.a.c.l.d.p.PipelineRunner(run):51 Disabling state reconciler...
2025-11-18 17:12:31 destination INFO main i.a.c.l.d.p.PipelineRunner(run):64 Flushing final states...
2025-11-18 17:12:31 destination INFO main i.a.c.l.d.p.PipelineRunner(run):70 Destination Pipeline Completed — Exceptionally: java.lang.IllegalStateException: Sync completed, but unflushed states were detected.
2025-11-18 17:12:31 destination ERROR main i.a.c.AirbyteConnectorRunnable(run):38 Failed class io.airbyte.integrations.destination.clickhouse.cdk.WriteOperationV2 operation execution. java.lang.IllegalStateException: Sync completed, but unflushed states were detected.
	at io.airbyte.cdk.load.dataflow.pipeline.PipelineRunner.run(PipelineRunner.kt:69) ~[bulk-cdk-core-load-0.1.52.jar:?]
	at io.airbyte.cdk.load.dataflow.pipeline.PipelineRunner$run$1.invokeSuspend(PipelineRunner.kt) ~[bulk-cdk-core-load-0.1.52.jar:?]
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-2.1.10.jar:2.1.10-release-473]
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100) ~[kotlinx-coroutines-core-jvm-1.10.2.jar:?]
	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:263) ~[kotlinx-coroutines-core-jvm-1.10.2.jar:?]
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:94) ~[kotlinx-coroutines-core-jvm-1.10.2.jar:?]
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:70) ~[kotlinx-coroutines-core-jvm-1.10.2.jar:?]
	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) ~[kotlinx-coroutines-core-jvm-1.10.2.jar:?]
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48) ~[kotlinx-coroutines-core-jvm-1.10.2.jar:?]
	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) ~[kotlinx-coroutines-core-jvm-1.10.2.jar:?]
	at io.airbyte.cdk.load.dataflow.DestinationLifecycle.run(DestinationLifecycle.kt:41) ~[bulk-cdk-core-load-0.1.52.jar:?]
	at io.airbyte.integrations.destination.clickhouse.cdk.WriteOperationV2.execute(WriteOperationV2.kt:24) ~[io.airbyte.airbyte-integrations.connectors-destination-clickhouse.jar:?]
	at io.airbyte.cdk.AirbyteConnectorRunnable.run(AirbyteConnectorRunnable.kt:36) [bulk-cdk-core-base-0.1.52.jar:?]
	at picocli.CommandLine.executeUserObject(CommandLine.java:2030) [picocli-4.7.6.jar:4.7.6]
	at picocli.CommandLine.access$1500(CommandLine.java:148) [picocli-4.7.6.jar:4.7.6]
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465) [picocli-4.7.6.jar:4.7.6]
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2457) [picocli-4.7.6.jar:4.7.6]
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2419) [picocli-4.7.6.jar:4.7.6]
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277) [picocli-4.7.6.jar:4.7.6]
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2421) [picocli-4.7.6.jar:4.7.6]
	at picocli.CommandLine.execute(CommandLine.java:2174) [picocli-4.7.6.jar:4.7.6]
	at io.airbyte.cdk.AirbyteDestinationRunner$Companion.run(AirbyteConnectorRunner.kt:289) [bulk-cdk-core-base-0.1.52.jar:?]
	at io.airbyte.cdk.AirbyteDestinationRunner$Companion.run$default(AirbyteConnectorRunner.kt:75) [bulk-cdk-core-base-0.1.52.jar:?]
	at io.airbyte.integrations.destination.clickhouse.ClickhouseDestinationKt.main(ClickhouseDestination.kt:10) [io.airbyte.airbyte-integrations.connectors-destination-clickhouse.jar:?]
k
A message from kapa.ai
Based on the provided knowledge sources, there is no explicit mention of the error message: > java.lang.IllegalStateException: Sync completed, but unflushed states were detected. in the context of syncing from MSSQL to ClickHouse V2 or any other destination. The available documentation and issues discuss state handling principles, state message formats, and related errors, but do not directly address this specific exception or its root cause. However, related issues and documentation highlight the importance of correct state emission and handling in Airbyte: - Sources must emit state messages appropriately, and destinations must return state messages in the order received. Improper state handling (such as missing, duplicate, or out-of-order state messages) can cause sync failures or unexpected behavior, but the exact error you are seeing is not documented in the sources provided [State Principles](https://docs.airbyte.com/platform/next/understanding-airbyte/airbyte-protocol#state-principles). - There are other errors related to missing terminal stream status messages, which may indicate issues in the source or platform, but these are not the same as the "unflushed states" error ([source-clickhouse issue](https://github.com/airbytehq/airbyte/issues/61419), [mssql sync issue](https://github.com/airbytehq/airbyte/issues/68150)). Summary: I'm sorry, but the knowledge sources do not contain enough information to explain or resolve the "Sync completed, but unflushed states were detected" error for your MSSQL to ClickHouse V2 sync. You may need to consult Airbyte's community or open a new issue with detailed logs for further assistance.