apache/pulsar · error · IllegalArgumentException

BatchSourceConfig does not specify Discovery Trigger ClassNa

Error message

BatchSourceConfig does not specify Discovery Trigger ClassName

What it means

A BatchSourceConfig must name the class that triggers/discoveres batches (discoveryTriggererClassName). validateBatchSourceConfig logs and throws when that field is empty or null, since the batch source has no way to discover records without it.

Source

Thrown at pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SourceConfigUtils.java:448

            mergedConfig.setCustomRuntimeOptions(newConfig.getCustomRuntimeOptions());
        }
        if (isBatchSource(existingConfig) != isBatchSource(newConfig)) {
            throw new IllegalArgumentException("Sources cannot be update between regular sources and batchsource");
        }
        if (newConfig.getBatchSourceConfig() != null) {
            validateBatchSourceConfigUpdate(existingConfig.getBatchSourceConfig(), newConfig.getBatchSourceConfig());
            mergedConfig.setBatchSourceConfig(newConfig.getBatchSourceConfig());
        }
        if (newConfig.getProducerConfig() != null) {
            mergedConfig.setProducerConfig(newConfig.getProducerConfig());
        }
        return mergedConfig;
    }

    public static void validateBatchSourceConfig(BatchSourceConfig batchSourceConfig) throws IllegalArgumentException {
        if (isEmpty(batchSourceConfig.getDiscoveryTriggererClassName())) {
            log.error("BatchSourceConfig does not specify Discovery Trigger ClassName");
            throw new IllegalArgumentException("BatchSourceConfig does not specify Discovery Trigger ClassName");
        }
    }

    public static Map<String, Object> extractSourceConfig(SourceSpec sourceSpec, String fqfn) {
        if (!StringUtils.isEmpty(sourceSpec.getConfigs())) {
            TypeReference<HashMap<String, Object>> typeRef =
                    new TypeReference<HashMap<String, Object>>() {
            };
            try {
                return ObjectMapperFactory.getMapper().reader().forType(typeRef).readValue(sourceSpec.getConfigs());
            } catch (IOException e) {
                log.error().attr("source", fqfn).exception(e)
                        .log("Failed to read configs for source");
                throw new RuntimeException(e);
            }
        } else {
            return null;
        }

View on GitHub (pinned to 820761864e)

Solutions

  1. Set discoveryTriggererClassName to the fully qualified class implementing DiscoveryTriggerer in the batchSourceConfig
  2. Confirm the triggerer class is packaged in the uploaded archive
  3. Fix JSON key spelling so the field deserializes correctly

Example fix

// before
"batchSourceConfig":{"batchSize":10}
// after
"batchSourceConfig":{"discoveryTriggererClassName":"org.apache.pulsar.functions.source.batch.builder.PulsarRecordGenerator","batchSize":10}
Defensive patterns

Strategy: validation

Validate before calling

if (config.getBatchSourceConfig() != null
    && (config.getBatchSourceConfig().getDiscoveryTriggererClassName() == null
        || config.getBatchSourceConfig().getDiscoveryTriggererClassName().isEmpty())) {
    throw new IllegalArgumentException("discoveryTriggererClassName is required in batchSourceConfig");
}

Try / catch

try { validateAndExtractDetails(...); } catch (IllegalArgumentException e) { if (e.getMessage().contains("Discovery Trigger ClassName")) { /* set discoveryTriggererClassName and resubmit */ } else { throw e; } }

Prevention

When it happens

Trigger: validateBatchSourceConfig (invoked from validateAndExtractDetails when batchSourceConfig is present) finds batchSourceConfig.getDiscoveryTriggererClassName() empty/null.

Common situations: batchSourceConfig JSON contains only batchSize or discoveryTriggererConfig but omits discoveryTriggererClassName; typo in the key name; the triggerer class field cleared during config editing.

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


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/dcec6feafabe77a8. Report an issue: GitHub.