apache/pulsar · error · IllegalArgumentException
LogTopic topic %s is invalid
Error message
LogTopic topic %s is invalid
What it means
If SourceConfig.logTopic is set, validateAndExtractDetails requires it to be a valid Pulsar topic (TopicName.isValid). The message embeds the offending value via String.format so the developer can see exactly which log topic string was rejected. The log topic is where the function framework writes user log statements.
Source
Thrown at pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SourceConfigUtils.java:279
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();
// if class name in source config is not set, this should be a built-in source
// thus we should try to find it class name in the NAR service definition
if (sourceClassName == null) {
ConnectorDefinition connectorDefinition = sourceFunction.getFunctionMetaData(ConnectorDefinition.class);
if (connectorDefinition == null) {
throw new IllegalArgumentException(
"Source package doesn't contain the META-INF/services/pulsar-io.yaml file.");View on GitHub (pinned to 820761864e)
Solutions
- Set logTopic to a fully-qualified name, e.g. persistent://public/default/source-log-topic (use the exact value from the error message to see what was rejected)
- Run TopicName.isValid(logTopic) in your tooling before submission and show a precise error
- If you don't need function logging routed to a topic, remove the logTopic field entirely (it is optional)
Example fix
// before
cfg.setLogTopic("source-logs");
// after
cfg.setLogTopic("persistent://public/default/source-logs"); Defensive patterns
Strategy: validation
Validate before calling
if (cfg.getLogTopic() != null && !org.apache.pulsar.common.naming.TopicName.isValid(cfg.getLogTopic())) {
throw new IllegalArgumentException("logTopic must be fully qualified: " + cfg.getLogTopic());
} Type guard
static boolean isValidLogTopic(SourceConfig cfg) {
return cfg == null || cfg.getLogTopic() == null
|| org.apache.pulsar.common.naming.TopicName.isValid(cfg.getLogTopic());
} Try / catch
try {
SourceConfigUtils.validateAndExtractDetails(cfg, pkg, true);
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().startsWith("LogTopic topic")) {
// the message names the bad value; correct it to a fully-qualified topic
}
} Prevention
- Use one convention for log topics across all functions, fully-qualified
- Generate logTopic from tenant/namespace/source name instead of hand-editing
- Omit logTopic entirely when function log routing is not needed
When it happens
Trigger: Setting sourceConfig.setLogTopic(...) to a malformed topic name — e.g. 'logs' without a domain, 'persistent://tenant/ns' missing the topic part, or names with illegal characters — then validating/registering the source.
Common situations: Copying the logTopic config between functions and truncating the qualified name; writing a bare topic name assuming defaults apply; typos introduced when templating configs across environments.
Related errors
- Topic name is invalid
- 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
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/8a986ed073dd6449.
Report an issue: GitHub.