apache/beam · error · IllegalStateException

Unexpected status [ ] of load job: .

Error message

Unexpected status [%s] of load job: %s.

What it means

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.

Solutions

  1. Inspect the logged status and pretty-printed job to see what the BigQuery API actually returned.
  2. Check the job's errorResult in the BigQuery console/API for the real failure reason.
  3. Upgrade to the latest Beam version so unrecognized statuses are handled; file a Beam issue if a new status value appears.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  poller.pollJob();
} catch (IllegalStateException e) {
  // log job.getStatus() and inspect job errorResult in BigQuery console
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/38c14c2f9d20d137. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryHelpers.java:281

            // job id.
            LOG.info(
                "Load job {} finished in unknown state, {}: {}",
                currentJobId,
                shouldRetry() ? "will retry" : "will not retry",
                statusToPrettyString(job.getStatus()));
            return false;
          case FAILED:
            String oldJobId = currentJobId.getJobId();
            currentJobId = getRetryJobId(currentJobId, lookupJob).jobId;
            LOG.warn(
                "Load job {} failed, {}: {}. Next job id {}",
                oldJobId,
                shouldRetry() ? "will retry" : "will not retry",
                statusToPrettyString(job.getStatus()),
                currentJobId);
            return false;
          default:
            throw new IllegalStateException(
                String.format(
                    "Unexpected status [%s] of load job: %s.",
                    job.getStatus(), jobToPrettyString(job)));
        }
      }
      return false;
    }

    boolean shouldRetry() {
      return currentAttempt < maxRetries + 1;
    }

    void logBigQueryError(@Nullable Job job) {
      if (job == null || !parseStatus(job).equals(Status.FAILED)) {
        return;
      }

      List<ErrorProto> jobErrors = job.getStatus().getErrors();

View on GitHub (pinned to 12126d8942)