{"record":{"id":"58132996782fb43d","repo":"alibaba/DataX","slug":"201","errorCode":"-201","errorMessage":"Target job failed for id: {jobId}","messagePattern":"Target job failed for id: (.+?)","errorType":"error_code","errorClass":"AdsException","httpStatus":null,"severity":"error","filePath":"adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/load/AdsHelper.java","lineNumber":359,"sourceCode":"        if (password == null) {\n            throw new AdsException(AdsException.ADS_CONN_PASSWORD_NOT_SET, \"ADS JDBC connection password was not set.\",\n                    null);\n        }\n\n        if (schema == null) {\n            throw new AdsException(AdsException.ADS_CONN_SCHEMA_NOT_SET, \"ADS JDBC connection schema was not set.\",\n                    null);\n        }\n\n        try {\n            String state = this.checkLoadDataJobStatusWithRetry(jobId);\n            if (state == null) {\n                throw new AdsException(AdsException.JOB_NOT_EXIST, \"Target job does not exist for id: \" + jobId, null);\n            }\n            if (state.equals(\"SUCCEEDED\")) {\n                return true;\n            } else if (state.equals(\"FAILED\")) {\n                throw new AdsException(AdsException.JOB_FAILED, \"Target job failed for id: \" + jobId, null);\n            } else {\n                return false;\n            }\n        } catch (Exception e) {\n            throw new AdsException(AdsException.OTHER, e.getMessage(), e);\n        } \n    }\n    \n    private String checkLoadDataJobStatusWithRetry(final String jobId)\n            throws AdsException {\n        try {\n            Class.forName(\"com.mysql.jdbc.Driver\");\n            final String finalAdsUrl = this.adsURL;\n            final String finalSchema = this.schema;\n            final Long finalSocketTimeout = this.socketTimeout;\n            final String suffix = this.suffix;\n            return RetryUtil.executeWithRetry(new Callable<String>() {\n                @Override","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/load/AdsHelper.java#L341-L377","documentation":"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, ...).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the failed load job's server-side logs/error details on ADS for the root cause","Check the staged/temp table data for type or constraint violations against the target ADS table","Fix the data or table definition, then resubmit the load job","Ensure your polling code treats FAILED as terminal instead of retrying"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (AdsException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Target job failed\")) {\n    // terminal: fetch ADS-side job logs, fix data, resubmit — do NOT retry the same job\n  }\n  throw e;\n}","preventionTips":["Treat FAILED state as terminal in polling loops","Validate staged data against target table constraints before submitting the load","Surface the ADS job id in logs so server-side diagnostics are easy"],"tags":["adswriter","job-status","ads","load-failure"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}