alibaba/DataX · error · AdsException

-201

-201

Error message

Target job failed for id: {jobId}

What it means

Thrown by AdsHelper.checkLoadDataJobStatus when the job's state string returned by ADS equals "FAILED". It signals the load-data job itself ran and failed server-side, as opposed to connection problems or a missing job. Because the throw occurs inside the try block, the outer catch (Exception e) re-wraps it as AdsException(OTHER, ...).

Source

Thrown at adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/load/AdsHelper.java:359

        if (password == null) {
            throw new AdsException(AdsException.ADS_CONN_PASSWORD_NOT_SET, "ADS JDBC connection password was not set.",
                    null);
        }

        if (schema == null) {
            throw new AdsException(AdsException.ADS_CONN_SCHEMA_NOT_SET, "ADS JDBC connection schema was not set.",
                    null);
        }

        try {
            String state = this.checkLoadDataJobStatusWithRetry(jobId);
            if (state == null) {
                throw new AdsException(AdsException.JOB_NOT_EXIST, "Target job does not exist for id: " + jobId, null);
            }
            if (state.equals("SUCCEEDED")) {
                return true;
            } else if (state.equals("FAILED")) {
                throw new AdsException(AdsException.JOB_FAILED, "Target job failed for id: " + jobId, null);
            } else {
                return false;
            }
        } catch (Exception e) {
            throw new AdsException(AdsException.OTHER, e.getMessage(), e);
        } 
    }
    
    private String checkLoadDataJobStatusWithRetry(final String jobId)
            throws AdsException {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            final String finalAdsUrl = this.adsURL;
            final String finalSchema = this.schema;
            final Long finalSocketTimeout = this.socketTimeout;
            final String suffix = this.suffix;
            return RetryUtil.executeWithRetry(new Callable<String>() {
                @Override

View on GitHub (pinned to 80ec23d5c5)

Solutions

  1. Inspect the failed load job's server-side logs/error details on ADS for the root cause
  2. Check the staged/temp table data for type or constraint violations against the target ADS table
  3. Fix the data or table definition, then resubmit the load job
  4. Ensure your polling code treats FAILED as terminal instead of retrying
Defensive patterns

Strategy: try-catch

Try / catch

catch (AdsException e) {
  if (e.getMessage() != null && e.getMessage().contains("Target job failed")) {
    // terminal: fetch ADS-side job logs, fix data, resubmit — do NOT retry the same job
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling checkLoadDataJobStatus(jobId) after ADS marked the load job FAILED — e.g. load data into the target table failed due to bad rows, target table issues, or resource errors on ADS.

Common situations: Load data rejected because of constraint violations, type mismatches in staged data, truncated temp table, or ADS-side errors; polling loop that treats this exception as transient and retries forever.

Related errors


AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14). Data as JSON: /api/errors/58132996782fb43d. Report an issue: GitHub.