apache/pulsar · error · IllegalArgumentException
Source name cannot be null
Error message
Source name cannot be null
What it means
validateAndExtractDetails enforces that SourceConfig.name is non-null and non-empty, since the name completes the mandatory tenant/namespace/name identity of a source connector. It is the third required-field check, thrown after tenant and namespace validation succeed.
Source
Thrown at pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SourceConfigUtils.java:272
if (!isEmpty(functionDetails.getCustomRuntimeOptions())) {
sourceConfig.setCustomRuntimeOptions(functionDetails.getCustomRuntimeOptions());
}
return sourceConfig;
}
public static ExtractedSourceDetails validateAndExtractDetails(SourceConfig sourceConfig,
ValidatableFunctionPackage sourceFunction,
boolean validateConnectorConfig) {
if (isEmpty(sourceConfig.getTenant())) {
throw new IllegalArgumentException("Source tenant cannot be null");
}
if (isEmpty(sourceConfig.getNamespace())) {
throw new IllegalArgumentException("Source namespace cannot be null");
}
if (isEmpty(sourceConfig.getName())) {
throw new IllegalArgumentException("Source name cannot be null");
}
if (!isEmpty(sourceConfig.getTopicName()) && !TopicName.isValid(sourceConfig.getTopicName())) {
throw new IllegalArgumentException("Topic name is invalid");
}
if (!isEmpty(sourceConfig.getLogTopic())) {
if (!TopicName.isValid(sourceConfig.getLogTopic())) {
throw new IllegalArgumentException(
String.format("LogTopic topic %s is invalid", sourceConfig.getLogTopic()));
}
}
if (sourceConfig.getParallelism() != null && sourceConfig.getParallelism() <= 0) {
throw new IllegalArgumentException("Source parallelism must be a positive number");
}
if (sourceConfig.getResources() != null) {
ResourceConfigUtils.validate(sourceConfig.getResources());
}
String sourceClassName = sourceConfig.getClassName();View on GitHub (pinned to 820761864e)
Solutions
- Set a non-empty name on the SourceConfig, e.g. sourceConfig.setName("kafka-source")
- If the name should be derived (e.g. from topic or connector), compute it before validation
- Add pre-validation in your submission tooling to reject blank source names with a friendly message
Example fix
// before
SourceConfig cfg = new SourceConfig();
cfg.setTenant("public");
cfg.setNamespace("default");
// after
SourceConfig cfg = new SourceConfig();
cfg.setTenant("public");
cfg.setNamespace("default");
cfg.setName("kafka-source"); Defensive patterns
Strategy: validation
Validate before calling
if (cfg.getName() == null || cfg.getName().trim().isEmpty()) {
throw new IllegalArgumentException("sourceConfig.name must be a non-empty source name");
} Type guard
static boolean hasName(SourceConfig cfg) {
return cfg != null && cfg.getName() != null && !cfg.getName().trim().isEmpty();
} Try / catch
try {
SourceConfigUtils.validateAndExtractDetails(cfg, pkg, true);
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().contains("Source name cannot be null")) {
// prompt for / default a source name before retrying
}
} Prevention
- Derive the source name from a stable input (topic, connector id) and assert it is non-empty before submission
- Never leave placeholder names in templates — fail your pipeline if placeholders remain
- Check tenant/namespace/name as one unit before calling any Pulsar API
When it happens
Trigger: Registering or validating a source whose SourceConfig has tenant and namespace set but name null or empty — e.g. a config file missing the 'name' key, or building SourceConfig dynamically and never calling setName().
Common situations: Generating SourceConfigs in loops where the name is derived from input that was blank; template configs with a placeholder name never substituted; REST/CLI callers omitting the name field.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- When effectively once processing guarantee is specified, ret
- Only one of retain ordering or retain key ordering can be se
- Receiver queue size should be >= zero
- Source tenant cannot be null
- Source namespace cannot be null
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/9e4e15ba73ece06c.
Report an issue: GitHub.