apache/beam · error · RuntimeException

No destination uri file count received.

Error message

No destination uri file count received.

What it means

Thrown when consolidating per-destination file counts produced by the BigQuery extract/write job: the map of destination-uri to file count is empty (no counts received) or has more than one entry, which the load step cannot handle.

Solutions

  1. Check that the extract stage produced temp files in the extractDestinationDir
  2. Retry the job — empty side inputs are often transient runner issues
  3. Verify dynamic destination configuration so each destination receives exactly one count
  4. Check Beam issue tracker / upgrade Beam version for known load-consolidation bugs
Defensive patterns

Strategy: try-catch

Try / catch

Map<ResourceId, Long> counts = /* side input results */;
if (counts == null || counts.size() != 1) {
  throw new IllegalStateException(
      "Expected exactly one destination file count, got: " + (counts == null ? "none" : counts.size()));
}

Prevention

When it happens

Trigger: After a batch BigQuery write (FILE_LOADS/EXPORT path), the count of temp files per destination URI arrives via a side input but is empty or contains multiple entries where exactly one is expected.

Common situations: Upstream extract job produced no files; runner side-input delivery issues; misconfigured dynamic destinations producing multiple counts where code expects one.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

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

    }
  }

  static String getExtractDestinationUri(String extractDestinationDir) {
    return String.format("%s/%s", extractDestinationDir, "*.avro");
  }

  static List<ResourceId> getExtractFilePaths(String extractDestinationDir, Job extractJob)
      throws IOException {
    JobStatistics jobStats = extractJob.getStatistics();
    List<Long> counts = jobStats.getExtract().getDestinationUriFileCounts();
    if (counts.size() != 1) {
      String errorMessage =
          counts.isEmpty()
              ? "No destination uri file count received."
              : String.format(
                  "More than one destination uri file count received. First two are %s, %s",
                  counts.get(0), counts.get(1));
      throw new RuntimeException(errorMessage);
    }
    long filesCount = counts.get(0);

    ImmutableList.Builder<ResourceId> paths = ImmutableList.builder();
    ResourceId extractDestinationDirResourceId =
        FileSystems.matchNewResource(extractDestinationDir, true /* isDirectory */);
    for (long i = 0; i < filesCount; ++i) {
      ResourceId filePath =
          extractDestinationDirResourceId.resolve(
              String.format("%012d%s", i, ".avro"),
              ResolveOptions.StandardResolveOptions.RESOLVE_FILE);
      paths.add(filePath);
    }
    return paths.build();
  }

  /////////////////////////////////////////////////////////////////////////////

View on GitHub (pinned to 12126d8942)