apache/beam · error · IllegalArgumentException

The partitions and have no overlap

Error message

The partitions %s and %s have no overlap

What it means

ByteStringRangeHelper.getIntersectingPartition computes the overlap of two Bigtable change-stream partitions (key ranges). If doPartitionsOverlap reports the two ByteStringRange partitions are disjoint, it throws IllegalArgumentException naming both formatted ranges, because an intersection would be empty/undefined.

Solutions

  1. Before intersecting, call doPartitionsOverlap(p1, p2) and handle the non-overlapping case explicitly.
  2. Ensure the partition comes from the same stream run/snapshot; re-read the current partition from the metadata table.
  3. Check for tablet split/merge events and refresh partition metadata before computing intersections.

Example fix

// before
ByteStringRange inter = ByteStringRangeHelper.getIntersectingPartition(p1, p2);
// after
if (ByteStringRangeHelper.doPartitionsOverlap(p1, p2)) {
  ByteStringRange inter = ByteStringRangeHelper.getIntersectingPartition(p1, p2);
} else { /* refresh partition metadata */ }
Defensive patterns

Strategy: try-catch

Validate before calling

if (!ByteStringRangeHelper.doPartitionsOverlap(p1, p2)) {
  throw new IllegalStateException("Refusing to intersect non-overlapping partitions " + p1 + " / " + p2);
}

Try / catch

try {
  ByteStringRange inter = ByteStringRangeHelper.getIntersectingPartition(p1, p2);
} catch (IllegalArgumentException e) {
  // partitions are disjoint: refresh partition metadata from the metadata table and retry once
  partitions = metadataTableDao.getPartitionsForStream(streamId);
}

Prevention

When it happens

Trigger: Calling getIntersectingPartition(p1, p2) with ranges that do not overlap — e.g. computing the intersection of a partition with a sibling partition after a split, or with a stale partition whose keys were reassigned.

Common situations: Bigtable change-stream connector internals: resuming a stream against a partition whose boundaries changed after an automatic tablet split/merge, or mixing partitions from different snapshots/watermark states.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/changestreams/ByteStringRangeHelper.java:299

    return ByteString.unsignedLexicographicalComparator()
                .compare(partition.getStart(), partition.getEnd())
            < 0
        || partition.getEnd().isEmpty();
  }

  /**
   * Return the overlapping parts of 2 partitions. Throw IllegalArgumentException if the 2
   * partitions don't overlap at all.
   *
   * @param p1 first partition
   * @param p2 second partition
   * @return the intersection of the 2 partitions
   * @throws IllegalArgumentException if the 2 partitions don't overlap at all
   */
  public static ByteStringRange getIntersectingPartition(ByteStringRange p1, ByteStringRange p2)
      throws IllegalArgumentException {
    if (!doPartitionsOverlap(p1, p2)) {
      throw new IllegalArgumentException(
          String.format(
              "The partitions %s and %s have no overlap",
              formatByteStringRange(p1), formatByteStringRange(p2)));
    }
    ByteString start = p1.getStart();
    ByteString end = p1.getEnd();
    if (compareStartKey(start, p2.getStart()) < 0) {
      start = p2.getStart();
    }
    if (compareEndKey(end, p2.getEnd()) > 0) {
      end = p2.getEnd();
    }
    return ByteStringRange.create(start, end);
  }
}

View on GitHub (pinned to 12126d8942)