apache/druid · error · SegmentLoadingException

Target S3 bucket is not specified

Error message

Target S3 bucket is not specified

What it means

During segment move, when the target bucket is derived by listing the target location, an empty targetS3Bucket means the DataSegment_move metadata did not carry a destination bucket. Moving without a bucket is impossible, so a SegmentLoadingException is thrown per object.

Source

Thrown at extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3DataSegmentMover.java:97

      final String targetS3Bucket = MapUtils.getString(targetLoadSpec, "bucket");
      final String targetS3BaseKey = MapUtils.getString(targetLoadSpec, "baseKey");
      final String targetS3Path;

      if (s3Path.endsWith("/")) {
        // segment is not compressed, list objects and move them all
        ListObjectsV2Request request = ListObjectsV2Request.builder()
            .bucket(s3Bucket)
            .prefix(s3Path + "/")
            .build();
        final ListObjectsV2Response list = s3ClientSupplier.get().listObjectsV2(request);
        targetS3Path = S3Utils.constructSegmentBasePath(
            targetS3BaseKey,
            DataSegmentPusher.getDefaultStorageDir(segment, false)
        );
        for (S3Object objectSummary : list.contents()) {
          final String fileName = Paths.get(objectSummary.key()).getFileName().toString();
          if (targetS3Bucket.isEmpty()) {
            throw new SegmentLoadingException("Target S3 bucket is not specified");
          }
          if (targetS3Path.isEmpty()) {
            throw new SegmentLoadingException("Target S3 baseKey is not specified");
          }

          safeMove(s3Bucket, s3Path, targetS3Bucket, targetS3Path + "/" + fileName);
        }
      } else {
        targetS3Path = S3Utils.constructSegmentPath(
            targetS3BaseKey,
            DataSegmentPusher.getDefaultStorageDir(segment, false)
        );

        if (targetS3Bucket.isEmpty()) {
          throw new SegmentLoadingException("Target S3 bucket is not specified");
        }
        if (targetS3Path.isEmpty()) {
          throw new SegmentLoadingException("Target S3 baseKey is not specified");

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Resend the move operation including the target "bucket" in the DataSegment_move loadSpec.
  2. Verify the move task JSON in the coordinator console shows a non-empty bucket.
  3. Check the client/tooling version that constructs the move payload for regressions.

Example fix

// before: {"type":"move","to":{"type":"s3_zip","bucket":"","baseKey":"s3/base"}}
// after: {"type":"move","to":{"type":"s3_zip","bucket":"target-bucket","baseKey":"s3/base"}}
Defensive patterns

Strategy: validation

Validate before calling

// validate move payload before submission
if (target == null || target.getBucket() == null || target.getBucket().isEmpty()) {
  throw new IllegalArgumentException("DataSegment_move requires non-empty bucket");
}

Try / catch

try { mover.move(segment, target); } catch (SegmentLoadingException e) { fixAndResubmitMove(); }

Prevention

When it happens

Trigger: move() is called with a segment whose loadSpec target (via DataSegment_move with bucket/baseKey) resolves to an empty targetS3Bucket while iterating listed objects in the source location.

Common situations: Coordinator move request sent with null/empty bucket field, misconfigured move task spec, older UI/client omitting the bucket parameter.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/1f4b6077f66bb1bc. Report an issue: GitHub.