ADF Pipeline failed with error "An insufficient number of arguments were supplied for the procedure or function cdc.fn_cdc_get_net_changes"

Aaron Wong 40 Reputation points
2025-07-31T18:04:05.8066667+00:00

I have a pipeline setup to copy set of tables from a source Azure DB into another Azure SQL DB. The pipeline has CDC enabled dataflow. The tables that I am trying to copy/sync have the CDC enabled. I have a setup/metadatatable where I have columns - Sourceschema, sourcetablename, targetschema, targettablename, checkpoint , keycolumn and pipleine_name.

Inside the pipeline I am using a Lookup activity to query my setup table and get the columns into different parameters/variables. I have the checkpoint column as "Intex2_DataCopy_CLO_US_Collat_Stats_CK1" and I am passing this to the pipeline. I am not maintaining the lsn values anywhere, I guess Azure SQL CDC internally maintains it somewhere to identify which rows need to be synced.

I am using a similar setup for another client and the pipelines are working properly on a trigger to run daily and do the incremental changes.

The new pipeline worked fine when I triggered it manually the first time, the tables data got copied successfully into my sink database. However, when I trying to trigger it again manually, the pipeline is failing with the following error. All the dataflow activities within the pipeline failed with similar error. Please let me know what could potentially be causing this error to happen and how to fix it or avoid it in future -

"Job failed due to reason: at Source 'IntexSource': Failed while creating PreparedStatement due to org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 0.0 failed 1 times, most recent failure: Lost task 0.0 in stage 0.0 (TID 0) (vm-52b34269 executor 1): shaded.msdataflow.com.microsoft.sqlserver.jdbc.SQLServerException: An insufficient number of arguments were supplied for the procedure or function cdc.fn_cdc_get_net_changes_ ... .

at shaded.msdataflow.com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:265)

at shaded.msdataflow.com.microsoft.sqlserver.jdbc.SQLServerResultSet$FetchBuffer.nextRow(SQLServerResultSet.java:5477)

at shaded.msdataflow.com.microsoft.sqlserver.jdbc.SQLServerResultSet.fetchBufferNext(SQLServerResultSet.java:1790)

at shaded.msdataflow.com.microsoft.sqlserver.jdbc.SQLServerResultSet.next(SQLServerResultSet.java:1048)

at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anon$1.getNext(JdbcUtils.scala:357)"
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
{count} votes

Accepted answer
  1. Smaran Thoomu 28,225 Reputation points Microsoft External Staff Moderator
    2025-08-07T16:41:42.48+00:00

    Hi Aaron Wong
    We have internally reviewed the case and also connected with you to investigate further. Based on our discussion and testing, the issue was resolved by updating the checkpoint value used in your metadata/control table. After adjusting the checkpoint, the pipelines started running successfully without triggering the cdc.fn_cdc_get_net_changes error.

    This indicates that the issue was likely due to the checkpoint pointing to an invalid or expired LSN range, which caused the CDC function to receive incomplete parameters during execution. Once the checkpoint was corrected, ADF was able to fetch the valid LSN window and resume CDC operations as expected.

    Changing the checkpoint value fixed the issue, and the pipeline is now working consistently. The customer confirmed there are no further issues.

    As a best practice, we recommend tracking and persisting the start_lsn and end_lsn values for each successful run, so that recovery is smoother in case of unexpected failures or state mismatches in future runs.


    Hope this helps. If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.