apache/beam · error · IllegalArgumentException

input is expected to be empty

Error message

%s %s input is expected to be empty

What it means

BigQueryExportReadSchemaTransformProvider's expand() rejects any non-empty PCollectionRowTuple input; this SchemaTransform reads directly from BigQuery via export and therefore must have no input PCollections. The library throws IllegalArgumentException eagerly so a mis-wired pipeline fails at graph construction instead of silently hanging waiting for input it will never consume.

Solutions

  1. Do not connect any PCollection into this transform; invoke expand with an empty PCollectionRowTuple, e.g. PCollectionRowTuple.empty(pipeline) or the provider's from()/buildTransform() with no inputs.
  2. If you meant to write data to BigQuery, use a BigQuery write SchemaTransform or BigQueryIO.write instead of the export read transform.
  3. Review the pipeline graph wiring (tuple tags) so only side-input-free root transforms feed this provider.

Example fix

// before
PCollectionRowTuple input = PCollectionRowTuple.of("rows", rows);
PCollectionRowTuple output = bigqueryExportRead.expand(input);

// after
PCollectionRowTuple empty = PCollectionRowTuple.empty(rows.getPipeline());
PCollectionRowTuple output = bigqueryExportRead.expand(empty);
Defensive patterns

Strategy: validation

Validate before calling

if (input != null && !input.getAll().isEmpty()) {
  throw new IllegalArgumentException(
      "BigQuery export read SchemaTransform accepts no inputs; got: " + input.getAll().keySet());
}

Try / catch

try {
  output = transform.expand(input);
} catch (IllegalArgumentException e) {
  // rewire pipeline so no PCollection feeds the export read transform
}

Prevention

When it happens

Trigger: Calling .expand(PCollectionRowTuple) with a tuple containing one or more named input Pcollections, e.g. wiring an upstream transform's output into the BigQuery export read SchemaTransform via PCollectionRowTuple.of(...).

Common situations: Building SchemaTransform pipelines with the SchemaTransformProvider API where a developer accidentally connects the output of a previous stage (e.g. a read or SQL transform) into this read-only root transform; YAML/Java pipeline composition tools that mis-map input tuple tags.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

  protected static class BigQueryExportSchemaTransform extends SchemaTransform {
    /** An instance of {@link BigQueryServices} used for testing. */
    private @Nullable BigQueryServices testBigQueryServices = null;

    private final BigQueryExportReadSchemaTransformConfiguration configuration;

    BigQueryExportSchemaTransform(BigQueryExportReadSchemaTransformConfiguration configuration) {
      this.configuration = configuration;
    }

    @VisibleForTesting
    void setTestBigQueryServices(BigQueryServices testBigQueryServices) {
      this.testBigQueryServices = testBigQueryServices;
    }

    @Override
    public PCollectionRowTuple expand(PCollectionRowTuple input) {
      if (!input.getAll().isEmpty()) {
        throw new IllegalArgumentException(
            String.format(
                "%s %s input is expected to be empty",
                input.getClass().getSimpleName(), getClass().getSimpleName()));
      }

      BigQueryIO.TypedRead<TableRow> read = toTypedRead();
      if (testBigQueryServices != null) {
        read = read.withTestServices(testBigQueryServices).withoutValidation();
      }

      PCollection<TableRow> tableRowPCollection = input.getPipeline().apply(read);
      Schema schema = tableRowPCollection.getSchema();
      PCollection<Row> rowPCollection =
          tableRowPCollection.apply(
              MapElements.into(TypeDescriptor.of(Row.class))
                  .via((tableRow) -> BigQueryUtils.toBeamRow(schema, tableRow)));
      return PCollectionRowTuple.of(OUTPUT_TAG, rowPCollection.setRowSchema(schema));
    }

View on GitHub (pinned to 12126d8942)