apache/pulsar · error · IllegalArgumentException
Batch Configs cannot be found
Error message
Batch Configs cannot be found
What it means
BatchSourceExecutor.getBatchSourceConfigs validates that the source config map contains both the batch source config JSON (BATCHSOURCE_CONFIG_KEY) and the discovery triggerer class name (BATCHSOURCE_CLASSNAME_KEY). Thrown as IllegalArgumentException when either key is missing.
Source
Thrown at pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/batch/BatchSourceExecutor.java:120
intermediateTopicConsumer.acknowledgeAsync(currentTask.getMessageId()).exceptionally(throwable -> {
log.error()
.attr("messageId", currentTask.getMessageId())
.exception(throwable)
.log("Encountered error when acknowledging completed task");
setCurrentError(throwable);
return null;
});
currentTask = null;
} else {
return retval;
}
}
}
private void getBatchSourceConfigs(Map<String, Object> config) {
if (!config.containsKey(BatchSourceConfig.BATCHSOURCE_CONFIG_KEY)
|| !config.containsKey(BatchSourceConfig.BATCHSOURCE_CLASSNAME_KEY)) {
throw new IllegalArgumentException("Batch Configs cannot be found");
}
String batchSourceConfigJson = (String) config.get(BatchSourceConfig.BATCHSOURCE_CONFIG_KEY);
this.batchSourceConfig = new Gson().fromJson(batchSourceConfigJson, BatchSourceConfig.class);
this.batchSourceClassName = (String) config.get(BatchSourceConfig.BATCHSOURCE_CLASSNAME_KEY);
}
private void initializeBatchSource() {
// First init the batchsource
ClassLoader clsLoader = Thread.currentThread().getContextClassLoader();
Object userClassObject = Reflections.createInstance(
batchSourceClassName,
clsLoader);
if (userClassObject instanceof BatchSource) {
@SuppressWarnings("unchecked") // type parameter is erased at runtime
BatchSource<T> typedBatchSource = (BatchSource<T>) userClassObject;
batchSource = typedBatchSource;
} else {View on GitHub (pinned to 820761864e)
Solutions
- Create the batch source via the proper submission path (pulsar-admin sources create with a batch source, or the Functions API used by the batch source tooling) so config keys are injected.
- Verify the config map contains both BATCHSOURCE_CONFIG_KEY and BATCHSOURCE_CLASSNAME_KEY entries.
- Upgrade pulsar-client-admin / CLI to a version matching the broker.
Example fix
// before: plain function creation without batch metadata
pulsar-admin functions create --classname com.example.MyBatchSource ...
// after: use the batch source submission tooling / include in userConfig
--user-config "__BATCHSOURCECONFIGS__={...},__BATCHSOURCECLASSNAME__=com.example.MyBatchSource$Builder" Defensive patterns
Strategy: validation
Validate before calling
Map<String,Object> cfg = sourceConfig.getConfigs(); Objects.requireNonNull(cfg.get(BatchSourceConfig.BATCHSOURCE_CONFIG_KEY), "missing " + BatchSourceConfig.BATCHSOURCE_CONFIG_KEY); Objects.requireNonNull(cfg.get(BatchSourceConfig.BATCHSOURCE_CLASSNAME_KEY), "missing " + BatchSourceConfig.BATCHSOURCE_CLASSNAME_KEY);
Type guard
boolean hasBatchKeys(Map<String,Object> cfg) {
return cfg != null
&& cfg.containsKey(BatchSourceConfig.BATCHSOURCE_CONFIG_KEY)
&& cfg.containsKey(BatchSourceConfig.BATCHSOURCE_CLASSNAME_KEY);
} Try / catch
try {
executor.open(cfg);
} catch (IllegalArgumentException e) {
if (e.getMessage().equals("Batch Configs cannot be found")) {
// resubmit via the batch source submission API
}
} Prevention
- Always submit batch sources through the batch source submission tooling
- Never hand-edit generated function configs
- Keep CLI/client versions aligned with the broker
When it happens
Trigger: Opening a batch source whose user config Map<String,Object> lacks "__BATCHSOURCECONFIGS__" or "__BATCHSOURCECLASSNAME__" keys — i.e. the function was not registered through the batch source submission flow.
Common situations: Submitting a BatchSource with plain pulsar-admin functions create instead of the batch source submission API/CLI; hand-writing function configs; client tooling from an older version that doesn't inject batch source metadata.
Related errors
- Either a Java jar or a Python file or a Go executable binary
- Either a Java jar or a Python file or a Go executable binary
- Function Name not provided
- State key needs to be specified
- Either a trigger value or a trigger filepath needs to be spe
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/527b39a266abd608.
Report an issue: GitHub.