{"record":{"id":"38c14c2f9d20d137","repo":"apache/beam","slug":"unexpected-status-s-of-load-job-s","errorCode":null,"errorMessage":"Unexpected status [%s] of load job: %s.","messagePattern":"Unexpected status \\[(.+?)\\] of load job: (.+?)\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryHelpers.java","lineNumber":281,"sourceCode":"            // job id.\n            LOG.info(\n                \"Load job {} finished in unknown state, {}: {}\",\n                currentJobId,\n                shouldRetry() ? \"will retry\" : \"will not retry\",\n                statusToPrettyString(job.getStatus()));\n            return false;\n          case FAILED:\n            String oldJobId = currentJobId.getJobId();\n            currentJobId = getRetryJobId(currentJobId, lookupJob).jobId;\n            LOG.warn(\n                \"Load job {} failed, {}: {}. Next job id {}\",\n                oldJobId,\n                shouldRetry() ? \"will retry\" : \"will not retry\",\n                statusToPrettyString(job.getStatus()),\n                currentJobId);\n            return false;\n          default:\n            throw new IllegalStateException(\n                String.format(\n                    \"Unexpected status [%s] of load job: %s.\",\n                    job.getStatus(), jobToPrettyString(job)));\n        }\n      }\n      return false;\n    }\n\n    boolean shouldRetry() {\n      return currentAttempt < maxRetries + 1;\n    }\n\n    void logBigQueryError(@Nullable Job job) {\n      if (job == null || !parseStatus(job).equals(Status.FAILED)) {\n        return;\n      }\n\n      List<ErrorProto> jobErrors = job.getStatus().getErrors();","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryHelpers.java#L263-L299","documentation":"Thrown by pollJob() when a BigQuery load job finishes in an unexpected status — neither DONE, PENDING, nor RUNNING. The library treats any other status value returned by the jobs.get API as an invariant violation and raises IllegalStateException with the status and the full pretty-printed job.","triggerScenarios":"pollJob() observes job.getStatus() outside the handled enum {DONE, PENDING, RUNNING} after the polling retry check, e.g. an unusual/undocumented status value returned by the BigQuery API for a load job.","commonSituations":"Rare: new or deprecated BigQuery job status values, corrupted job metadata, or API version changes where a load job reports a status the Beam client doesn't recognize.","solutions":["Inspect the logged status and pretty-printed job to see what the BigQuery API actually returned.","Check the job's errorResult in the BigQuery console/API for the real failure reason.","Upgrade to the latest Beam version so unrecognized statuses are handled; file a Beam issue if a new status value appears."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  poller.pollJob();\n} catch (IllegalStateException e) {\n  // log job.getStatus() and inspect job errorResult in BigQuery console\n}","preventionTips":["Keep Beam and google-api-services-bigquery client versions up to date.","Inspect failed jobs' status.errorResult in the BigQuery console when polling fails.","File/report unrecognized status values upstream so they can be handled."],"tags":["java","bigquery","unexpected-status","illegal-state"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}