{"record":{"id":"97841826c8ef06de","repo":"apache/seatunnel","slug":"bulk-job-create-failed","errorCode":"BULK_JOB_CREATE_FAILED","errorMessage":"HTTP \" + status + \": \" + responseBody","messagePattern":"HTTP \" \\+ status \\+ \": \" \\+ responseBody","errorType":"error_code","errorClass":"SalesforceConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-salesforce/src/main/java/org/apache/seatunnel/connectors/seatunnel/salesforce/client/SalesforceClient.java","lineNumber":221,"sourceCode":"        HttpPost post = new HttpPost(url);\n        post.setHeader(HttpHeaders.AUTHORIZATION, \"Bearer \" + accessToken);\n        post.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());\n        post.setHeader(HttpHeaders.ACCEPT, ContentType.APPLICATION_JSON.getMimeType());\n\n        try {\n            ObjectNode body = objectMapper.createObjectNode();\n            body.put(\"operation\", \"query\");\n            body.put(\"query\", soql);\n            post.setEntity(\n                    new StringEntity(\n                            objectMapper.writeValueAsString(body), ContentType.APPLICATION_JSON));\n\n            try (CloseableHttpResponse response = httpClient.execute(post)) {\n                int status = response.getStatusLine().getStatusCode();\n                String responseBody =\n                        EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);\n                if (status != 200) {\n                    throw new SalesforceConnectorException(\n                            SalesforceConnectorErrorCode.BULK_JOB_CREATE_FAILED,\n                            \"HTTP \" + status + \": \" + responseBody);\n                }\n                String jobId = objectMapper.readTree(responseBody).get(\"id\").asText();\n                log.info(\"Created Bulk API query job {} for SOQL: {}\", jobId, soql);\n                return jobId;\n            }\n        } catch (SalesforceConnectorException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new SalesforceConnectorException(\n                    SalesforceConnectorErrorCode.BULK_JOB_CREATE_FAILED, e);\n        }\n    }\n\n    private void waitForJobCompletion(String jobId) {\n        String url = authorizedInstanceUrl + String.format(JOB_PATH, params.getApiVersion(), jobId);\n        long deadline = System.currentTimeMillis() + params.getJobCompletionTimeoutMs();","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-salesforce/src/main/java/org/apache/seatunnel/connectors/seatunnel/salesforce/client/SalesforceClient.java#L203-L239","documentation":"Thrown by SalesforceClient.createBulkQueryJob when the POST to the Salesforce Bulk API v2 /jobs/query endpoint returns a non-200 status. It carries the HTTP status and response body, indicating the bulk query job could not be created.","triggerScenarios":"Creating a bulk query job with an invalid SOQL string, an invalid/expired access token, or malformed job request JSON (wrong contentType/object fields) so Salesforce returns 400/401/etc.","commonSituations":"SOQL with unsupported syntax or a nonexistent field in the query used by a tables_configs entry; token refresh failure; Salesforce Bulk API v2 not enabled for the org.","solutions":["Check the HTTP status and body in the message for Salesforce's specific error (e.g. InvalidBatchRequest, MALFORMED_QUERY)","Validate the SOQL manually in the Salesforce Developer Console / Workbench","Re-authenticate to obtain a fresh access token","Ensure Bulk API v2 is available/enabled in the org and the integration user has Bulk API permission"],"exampleFix":"// before\nsoql = \"SELECT Id, WrongField__c FROM Account\"\n// after\nsoql = \"SELECT Id, Name FROM Account\"  // fields verified in Developer Console","handlingStrategy":"try-catch","validationCode":"// validate SOQL first\n// SELECT Id FROM Account LIMIT 1 -- run in Developer Console / Workbench","typeGuard":null,"tryCatchPattern":"try {\n    String jobId = client.createBulkQueryJob(soql, object);\n} catch (SalesforceConnectorException e) {\n    log.error(\"Bulk job creation failed: {}\", e.getMessage());\n    throw e; // surface Salesforce body to the operator\n}","preventionTips":["Test the SOQL in Workbench before adding it to tables_configs","Only reference fields the integration user can read","Confirm Bulk API v2 is enabled for the org","Refresh the access token before long-running pipelines"],"tags":["http","salesforce","bulk-api"],"backgroundTag":"api-request-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}