apache/druid · error · SamplerException

Unable to create RecordSupplier: %s

Error message

Unable to create RecordSupplier: %s

What it means

SeekableStreamSamplerSpec.sample() creates the RecordSupplier (the Kafka/Kinesis consumer adapter) before sampling data. If createRecordSupplier() throws — bad consumer properties, missing config, incompatible dependency, provider/class loading failure — the exception is wrapped in a SamplerException with the root-cause message, prefixed 'Unable to create RecordSupplier'.

Source

Thrown at indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/SeekableStreamSamplerSpec.java:77

    this.dataSchema = Preconditions.checkNotNull(ingestionSpec, "[spec] is required").getDataSchema();
    this.ioConfig = Preconditions.checkNotNull(ingestionSpec.getIoConfig(), "[spec.ioConfig] is required");
    this.tuningConfig = ingestionSpec.getTuningConfig();
    this.samplerConfig = samplerConfig == null ? SamplerConfig.empty() : samplerConfig;
    this.inputSourceSampler = inputSourceSampler;
  }

  @Override
  public SamplerResponse sample()
  {
    final InputSource inputSource;
    final InputFormat inputFormat;
    RecordSupplier<PartitionIdType, SequenceOffsetType, RecordType> recordSupplier;

    try {
      recordSupplier = createRecordSupplier();
    }
    catch (Exception e) {
      throw new SamplerException(e, "Unable to create RecordSupplier: %s", Throwables.getRootCause(e).getMessage());
    }

    inputSource = new RecordSupplierInputSource<>(
        ioConfig.getStream(),
        recordSupplier,
        ioConfig.isUseEarliestSequenceNumber(),
        samplerConfig.getTimeoutMs() <= 0 ? null : samplerConfig.getTimeoutMs()
    );
    inputFormat = Preconditions.checkNotNull(
        ioConfig.getInputFormat(),
        "[spec.ioConfig.inputFormat] is required"
    );

    return inputSourceSampler.sample(inputSource, inputFormat, dataSchema, samplerConfig);
  }

  protected abstract RecordSupplier<PartitionIdType, SequenceOffsetType, RecordType> createRecordSupplier();
}

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Read the root-cause message after the colon and fix that specific config problem (e.g. add bootstrap.servers, fix SASL properties).
  2. Confirm the druid-kafka-indexing-service / druid-kinesis-indexing-service extension is loaded on the router/middle manager.
  3. Validate consumerProperties against the client library's documented config keys — remove or correct invalid entries.
  4. For Kinesis, verify AWS region and credentials (config, env, IAM role) resolve before sampling.

Example fix

// before: missing required consumer property
"ioConfig": {"topic": "events", "consumerProperties": {}}
// after: provide bootstrap servers
"ioConfig": {"topic": "events", "consumerProperties": {"bootstrap.servers": "broker1:9092,broker2:9092"}}
Defensive patterns

Strategy: validation

Validate before calling

// sanity-check required consumer properties before sampling
Map<String,Object> props = spec.getIoConfig().getConsumerProperties();
if (!props.containsKey("bootstrap.servers")) { throw new ValidationException("bootstrap.servers required"); }

Try / catch

try { sampler.sample(); } catch (SamplerException e) { log.error("RecordSupplier init failed: {}", Throwables.getRootCause(e).getMessage()); }

Prevention

When it happens

Trigger: Calling the sampling endpoint for a Kafka/Kinesis ingestion spec when createRecordSupplier() fails: missing bootstrap servers, invalid consumer config keys, wrong SASL/SSL settings, or the Kafka/Kinesis client libraries failing to initialize (missing extension jar, bad credentials provider).

Common situations: Kafka extension not loaded so consumer class/config is unavailable; typos in consumerProperties (e.g. bootstrap.servers missing); invalid AWS region/credentials for Kinesis; incompatible client library versions causing InstantiationException.

Related errors


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