apache/seatunnel · error · SalesforceConnectorException
BULK_JOB_FAILED
BULK_JOB_FAILED
Error message
Job " + jobId + " ended with state: " + state
What it means
Thrown by SalesforceClient.waitForJobCompletion when the Salesforce Bulk API v2 query job transitions to state 'Failed' or 'Aborted' instead of 'JobComplete'. The message includes the job id and terminal state.
Source
Thrown at seatunnel-connectors-v2/connector-salesforce/src/main/java/org/apache/seatunnel/connectors/seatunnel/salesforce/client/SalesforceClient.java:254
private void waitForJobCompletion(String jobId) {
String url = authorizedInstanceUrl + String.format(JOB_PATH, params.getApiVersion(), jobId);
long deadline = System.currentTimeMillis() + params.getJobCompletionTimeoutMs();
while (true) {
try {
Thread.sleep(params.getPollIntervalMs());
HttpGet get = new HttpGet(url);
get.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
try (CloseableHttpResponse response = httpClient.execute(get)) {
String responseBody =
EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
String state = objectMapper.readTree(responseBody).get("state").asText();
log.debug("Bulk API job {} state: {}", jobId, state);
if ("JobComplete".equals(state)) {
return;
}
if ("Failed".equals(state) || "Aborted".equals(state)) {
throw new SalesforceConnectorException(
SalesforceConnectorErrorCode.BULK_JOB_FAILED,
"Job " + jobId + " ended with state: " + state);
}
}
if (System.currentTimeMillis() > deadline) {
throw new SalesforceConnectorException(
SalesforceConnectorErrorCode.BULK_JOB_FAILED,
"Job "
+ jobId
+ " did not complete within "
+ params.getJobCompletionTimeoutMs()
+ "ms");
}
} catch (SalesforceConnectorException e) {
throw e;
} catch (Exception e) {
throw new SalesforceConnectorException(
SalesforceConnectorErrorCode.BULK_JOB_FAILED, e);View on GitHub (pinned to cf67b549a7)
Solutions
- Log in to Salesforce (Setup > Bulk Jobs or the job URL) to read the job's failure details/error message
- Fix the SOQL: narrow the query with filters, remove unsupported constructs, or reduce the data scope
- Re-run the connector to create a fresh job if the job was aborted externally
- Check Salesforce org status for maintenance or platform incidents
Example fix
// before soql = "SELECT Id, Name, (SELECT Id FROM hugeChild__r) FROM Account" // caused Failed // after soql = "SELECT Id, Name FROM Account WHERE CreatedDate > LAST_N_DAYS:30"
Defensive patterns
Strategy: try-catch
Try / catch
try {
client.executeBulkQuery(...);
} catch (SalesforceConnectorException e) {
if (e.getMessage().contains("state: Aborted")) {
// job was aborted externally; safe to recreate and retry
recreateJobAndRetry();
} else {
throw e; // genuine query failure, inspect job in Salesforce
}
} Prevention
- Avoid overly broad SOQL on huge objects; add WHERE filters
- Monitor the job in Setup > Bulk Jobs while the pipeline runs
- Coordinate with admins so jobs are not aborted mid-run
- Check Salesforce trust status for maintenance windows
When it happens
Trigger: Polling job state and observing 'Failed' (Salesforce rejected/could not execute the query, e.g. query timeout, object locked) or 'Aborted' (job aborted manually or by Salesforce policy).
Common situations: SOQL exceeding Salesforce limits (too many records, PBars/query timeout), another process or admin aborting the job, org maintenance causing job failure.
Related errors
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/ee88dd2ab570c58c.
Report an issue: GitHub.