apache/pulsar · error · IllegalArgumentException
Source class %s implements %s but batch source source config
Error message
Source class %s implements %s but batch source source config is not specified
What it means
During source validation, Pulsar detected that the source class implements BatchSource but the SourceConfig has no batchSourceConfig set. A BatchSource requires its discovery triggerer/record generator settings to operate, so the framework refuses to deploy a batch source without that configuration block.
Source
Thrown at pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SourceConfigUtils.java:325
try {
sourceClass = sourceFunction.resolveType(sourceClassName);
} catch (TypePool.Resolution.NoSuchTypeException e) {
throw new IllegalArgumentException(
String.format("Source class %s not found in class loader", sourceClassName), e);
}
if (!(sourceClass.asErasure().isAssignableTo(Source.class) || sourceClass.asErasure()
.isAssignableTo(BatchSource.class))) {
throw new IllegalArgumentException(
String.format("Source class %s does not implement the correct interface",
sourceClass.getName()));
}
if (sourceClass.asErasure().isAssignableTo(BatchSource.class)) {
if (sourceConfig.getBatchSourceConfig() != null) {
validateBatchSourceConfig(sourceConfig.getBatchSourceConfig());
} else {
throw new IllegalArgumentException(
String.format("Source class %s implements %s but batch source source config is not specified",
sourceClass.getName(), BatchSource.class.getName()));
}
}
// extract type from source class
TypeDefinition typeArg;
try {
typeArg = getSourceType(sourceClass);
} catch (Exception e) {
throw new IllegalArgumentException(
String.format("Failed to resolve type for Source class %s", sourceClassName), e);
}
// Only one of serdeClassName or schemaType should be set
if (!StringUtils.isEmpty(sourceConfig.getSerdeClassName()) && !StringUtils
.isEmpty(sourceConfig.getSchemaType())) {View on GitHub (pinned to 820761864e)
Solutions
- Add a batchSourceConfig object (with discoveryTriggererClassName, discoveryTriggererConfig, batchSize) to the SourceConfig before submitting
- Verify the className really needs to be a BatchSource; if a regular source suffices, use a class implementing Source instead of BatchSource
- Check config file/JSON key spelling and nesting so batchSourceConfig actually deserializes into the SourceConfig
- Re-submit the source with the corrected config
Example fix
// before
{"className":"com.example.MyBatchSource","topicName":"out"}
// after
{"className":"com.example.MyBatchSource","topicName":"out","batchSourceConfig":{"discoveryTriggererClassName":"com.example.MyTriggerer","discoveryTriggererConfig":{},"batchSize":10}} Defensive patterns
Strategy: validation
Validate before calling
if (config.getClassName() != null && isBatchSourceClass(config.getClassName(), loader)
&& config.getBatchSourceConfig() == null) {
throw new IllegalArgumentException("batchSourceConfig required for BatchSource class " + config.getClassName());
} Type guard
boolean isBatchSourceConfigured(SourceConfig c) { return c.getBatchSourceConfig() != null; } Try / catch
try { SourceConfigUtils.validateAndExtractDetails(...); } catch (IllegalArgumentException e) { if (e.getMessage().contains("batch source source config")) { /* add batchSourceConfig and retry */ } else { throw e; } } Prevention
- Always populate batchSourceConfig when the source class implements BatchSource
- Validate config JSON schema before submitting (required keys: discoveryTriggererClassName, batchSize)
- Keep separate config templates for batch vs regular sources
- Use the pulsar-admin source create validation early in CI
When it happens
Trigger: Calling SourceConfigUtils.validateAndExtractDetails with a SourceConfig whose className points to a class assignable to org.apache.pulsar.functions.source.BatchSource while sourceConfig.getBatchSourceConfig() returns null.
Common situations: Deploying a batch source connector via CLI/REST and forgetting the --batch-source-config JSON; copying a regular source config template for a batch source; a config file where the batchSourceConfig key is misspelled or nested incorrectly so it deserializes to null.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- BatchSourceConfig does not specify Discovery Trigger ClassNa
- Batch Configs cannot be found
- BatchSource does not implement the correct interface
- BatchSourceTriggerer does not implement the correct interfac
- error writing discovered task to intermediate topic
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/5fadac43e0e26c30.
Report an issue: GitHub.