apache/pulsar · error · IllegalArgumentException
Must specify Function, Source or Sink config
Error message
Must specify Function, Source or Sink config
What it means
LocalRunner requires exactly one of functionConfig, sourceConfig, or sinkConfig to be set, since it must build FunctionDetails from one of them. If none is configured it throws IllegalArgumentException with this message. This is a configuration-validation failure raised during start().
Source
Thrown at pulsar-functions/localrun/src/main/java/org/apache/pulsar/functions/LocalRunner.java:426
sinkConfig.getTransformFunctionClassName());
}
ClassLoader functionClassLoader = null;
ValidatableFunctionPackage validatableTransformFunction = null;
if (transformFunctionCodeClassLoader != null) {
functionClassLoader = transformFunctionCodeClassLoader.getClassLoader() == null
? Thread.currentThread().getContextClassLoader()
: transformFunctionCodeClassLoader.getClassLoader();
validatableTransformFunction =
new LoadedFunctionPackage(functionClassLoader, FunctionDefinition.class);
}
functionDetails = SinkConfigUtils.convert(
sinkConfig,
SinkConfigUtils.validateAndExtractDetails(sinkConfig, validatableFunctionPackage,
validatableTransformFunction, true));
} else {
throw new IllegalArgumentException("Must specify Function, Source or Sink config");
}
if (System.getProperty(FunctionCacheEntry.JAVA_INSTANCE_JAR_PROPERTY) == null) {
System.setProperty(FunctionCacheEntry.JAVA_INSTANCE_JAR_PROPERTY,
LocalRunner.class.getProtectionDomain().getCodeSource().getLocation().getFile());
}
AuthenticationConfig authConfig = AuthenticationConfig.builder().clientAuthenticationPlugin
(clientAuthPlugin)
.clientAuthenticationParameters(clientAuthParams).useTls(useTls)
.tlsAllowInsecureConnection(tlsAllowInsecureConnection)
.tlsHostnameVerificationEnable(tlsHostNameVerificationEnabled)
.tlsTrustCertsFilePath(tlsTrustCertFilePath).build();
String serviceUrl = DEFAULT_SERVICE_URL;
if (brokerServiceUrl != null) {
serviceUrl = brokerServiceUrl;
}View on GitHub (pinned to 820761864e)
Solutions
- Call one of setFunctionConfig, setSourceConfig, or setSinkConfig on LocalRunner before start()
- Verify the config field is not overwritten to null by later builder/negative code paths
- If configs are optional in your code, assert one is present before start
Example fix
// before
LocalRunner runner = new LocalRunner();
runner.start(true);
// after
FunctionConfig functionConfig = new FunctionConfig();
functionConfig.setClassName("org.example.MyFunction");
functionConfig.setInputs(Collections.singletonList("input-topic"));
functionConfig.setOutput("output-topic");
runner.setFunctionConfig(functionConfig);
runner.start(true); Defensive patterns
Strategy: validation
Validate before calling
if (runner.getFunctionConfig() == null && runner.getSourceConfig() == null
&& runner.getSinkConfig() == null) {
throw new IllegalStateException("Set functionConfig, sourceConfig, or sinkConfig before start");
} Try / catch
try {
runner.start(true);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Must specify Function, Source or Sink config")) {
// attach a config and restart with a fresh runner
}
} Prevention
- Always set exactly one of function/source/sink config before start
- Assert config presence in setup code
- Build runners via a helper that enforces the config requirement
When it happens
Trigger: Starting LocalRunner without calling setFunctionConfig/setSourceConfig/setSinkConfig, or after all three configs were explicitly cleared/reset to null.
Common situations: Programmatic runner construction missing the config step; config object built conditionally and left null; copying example code that used builder methods you omitted.
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
- failoverThreshold must be larger than 0
- recoverThreshold must be larger than 0
- checkHealthyIntervalMs must be larger than 0
- testTopic can not be blank
- pulsarServiceUrlArray can not be empty
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/7078026bea54b6fb.
Report an issue: GitHub.