apache/druid · error · UnsupportedOperationException (UOE)

Cannot open writer

Error message

Cannot open writer

What it means

Sentinel unsupported-operation inside the anonymous SimpleJavaFileObject built around the S3 input stream in S3DataSegmentPuller: only read-oriented operations (openInputStream, char content) are meaningful for segment data pulled from S3, so openWriter() is hard-coded to throw. It is never caused by S3 or user data — it only fires if something tries to treat the read-only S3-backed file object as writable.

Solutions

  1. Use the S3 storage uploader for writes instead of the segment puller's FileObject.
  2. Restructure code so write operations target local or writable storage.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3DataSegmentPuller.java:260 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

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

        throw new UOE("Cannot stream S3 output");
      }

      @Override
      public Reader openReader(boolean ignoreEncodingErrors)
      {
        throw new UOE("Cannot open reader");
      }

      @Override
      public CharSequence getCharContent(boolean ignoreEncodingErrors)
      {
        throw new UOE("Cannot open character sequence");
      }

      @Override
      public Writer openWriter()
      {
        throw new UOE("Cannot open writer");
      }

      @Override
      public long getLastModified()
      {
        if (s3InputStream != null) {
          Instant lastModified = s3InputStream.response().lastModified();
          return lastModified != null ? lastModified.toEpochMilli() : 0L;
        }
        if (objectMetadata == null) {
          objectMetadata = S3Utils.getSingleObjectMetadata(s3Client, coords.getBucket(), coords.getPath());
        }
        Instant lastModified = objectMetadata.lastModified();
        return lastModified != null ? lastModified.toEpochMilli() : 0L;
      }

      @Override
      public boolean delete()

View on GitHub (pinned to 9b90983fd2)