apache/druid · error · SegmentLoadingException

Target S3 baseKey is not specified

Error message

Target S3 baseKey is not specified

What it means

Same validation as the bucket check, but for the target base key: when moving within derived path mode, an empty targetS3Path means the move payload lacks the destination prefix, so the move cannot proceed.

Source

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

      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");
        }

        safeMove(s3Bucket, s3Path, targetS3Bucket, targetS3Path);

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Provide a non-empty "baseKey" in the DataSegment_move target loadSpec.
  2. Re-issue the move operation after correcting the payload.
  3. Add client-side validation that both bucket and baseKey are non-empty before submitting moves.

Example fix

// before: move target baseKey ""
// after: {"bucket":"target-bucket","baseKey":"druid/segments"}
Defensive patterns

Strategy: validation

Validate before calling

if (target == null || target.getBaseKey() == null || target.getBaseKey().isEmpty()) {
  throw new IllegalArgumentException("DataSegment_move requires non-empty baseKey");
}

Try / catch

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

Prevention

When it happens

Trigger: move() with DataSegment_move whose baseKey resolves to empty string, detected inside the list-contents loop before safeMove is executed.

Common situations: Move request sent with bucket set but baseKey omitted or blank string; scripting error building the move task payload.

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/2cd0deecf849e059. Report an issue: GitHub.