apache/pulsar · error · IllegalArgumentException

Discovery Triggerer not specified

Error message

Discovery Triggerer not specified

What it means

Thrown by validateBatchSourceConfigs when a SourceConfig includes a BatchSourceConfig whose discoveryTriggererClassName is blank. A Pulsar batch source needs a DiscoveryTriggerer class that discovers which batches to process; without it the batch source cannot be scheduled. The CLI rejects the config before submitting it.

Source

Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java:550

            if (!Utils.isFunctionPackageUrlSupported(sourceConfig.getArchive())
                    && !sourceConfig.getArchive().startsWith(Utils.BUILTIN)) {
                if (!new File(sourceConfig.getArchive()).exists()) {
                    throw new IllegalArgumentException(String.format("Source Archive %s does not exist",
                            sourceConfig.getArchive()));
                }
            }
            if (isBlank(sourceConfig.getName())) {
                throw new IllegalArgumentException("Source name not specified");
            }

            if (sourceConfig.getBatchSourceConfig() != null) {
                validateBatchSourceConfigs(sourceConfig.getBatchSourceConfig());
            }
        }

        protected void validateBatchSourceConfigs(BatchSourceConfig batchSourceConfig) {
            if (isBlank(batchSourceConfig.getDiscoveryTriggererClassName())) {
                throw new IllegalArgumentException("Discovery Triggerer not specified");
            }
        }

        protected String validateSourceType(String sourceType) throws IOException {
            Set<String> availableSources;
            try {
                availableSources = getAdmin().sources().getBuiltInSources().stream()
                        .map(ConnectorDefinition::getName).collect(Collectors.toSet());
            } catch (PulsarAdminException e) {
                throw new IOException(e);
            }

            if (!availableSources.contains(sourceType)) {
                throw new ParameterException(
                        "Invalid source type '" + sourceType + "' -- Available sources are: " + availableSources);
            }

            // Source type is a valid built-in connector type

View on GitHub (pinned to 820761864e)

Solutions

  1. Set discoveryTriggererClassName in the batch source config to a class implementing DiscoveryTriggerer available on the archive's classpath
  2. Remove the batchSourceConfig block if the source is not intended to be a batch source
  3. Verify the class name spelling and package

Example fix

// before
{"batchSourceConfig": {"discoveryTriggererClassName": ""}}
// after
{"batchSourceConfig": {"discoveryTriggererClassName": "org.example.MyDiscoveryTriggerer"}}
Defensive patterns

Strategy: validation

Validate before calling

if (sourceConfig.getBatchSourceConfig() != null
        && (sourceConfig.getBatchSourceConfig().getDiscoveryTriggererClassName() == null
            || sourceConfig.getBatchSourceConfig().getDiscoveryTriggererClassName().isBlank())) {
    throw new IllegalArgumentException("batchSourceConfig requires discoveryTriggererClassName");
}

Type guard

boolean hasDiscoveryTriggerer(BatchSourceConfig cfg) {
    return cfg != null && cfg.getDiscoveryTriggererClassName() != null
        && !cfg.getDiscoveryTriggererClassName().trim().isEmpty();
}

Try / catch

try {
    admin.sources().createSource(sourceConfig);
} catch (IllegalArgumentException e) {
    System.err.println("Batch source config incomplete: " + e.getMessage());
}

Prevention

When it happens

Trigger: Creating/updating a source with --batch-source-config (or a config file containing batchSourceConfig) where the discoveryTriggererClassName field is empty or missing.

Common situations: Hand-writing the batch source config JSON and omitting discoveryTriggererClassName, copying a template with the field left blank, or setting batchSourceConfig on a regular (non-batch) source by mistake.

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/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/611c7a874f4d814a. Report an issue: GitHub.