apache/pulsar · error · ParameterException
Cannot specify both jar and function-type
Error message
Cannot specify both jar and function-type
What it means
A function can be packaged either as a user-uploaded jar or as a built-in function type (built-in connectors/functions identified by function-type). FunctionDetailsCommand rejects a command specifying both jarFile and functionType with a ParameterException, since the runtime cannot decide between the two packaging modes.
Source
Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java:659
}
windowConfig.setSlidingIntervalDurationMs(slidingIntervalDurationMs);
}
functionConfig.setWindowConfig(windowConfig);
if (autoAck != null) {
functionConfig.setAutoAck(autoAck);
}
if (null != maxMessageRetries) {
functionConfig.setMaxMessageRetries(maxMessageRetries);
}
if (null != deadLetterTopic) {
functionConfig.setDeadLetterTopic(deadLetterTopic);
}
if (jarFile != null && functionType != null) {
throw new ParameterException("Cannot specify both jar and function-type");
}
if (null != jarFile) {
functionConfig.setJar(jarFile);
}
if (functionType != null) {
functionConfig.setJar("builtin://" + functionType);
} else if (functionConfig.getFunctionType() != null) {
functionConfig.setJar("builtin://" + functionConfig.getFunctionType());
}
if (null != pyFile) {
functionConfig.setPy(pyFile);
}
if (null != goFile) {
functionConfig.setGo(goFile);View on GitHub (pinned to 820761864e)
Solutions
- Remove --function-type if you are deploying your own jar.
- Remove --jar (and class name requirements) if you intend to use a built-in function type.
- Make wrapper scripts set exactly one of the two based on the deployment mode.
Example fix
// before pulsar-admin functions create --tenant public --namespace default --name ex --jar my.jar --function-type org.apache.pulsar.functions.api.examples.ExclamationFunction // after pulsar-admin functions create --tenant public --namespace default --name ex --jar my.jar --classname org.ex.MyFn
Defensive patterns
Strategy: validation
Validate before calling
if (jarFile != null && functionType != null) {
throw new IllegalArgumentException("Specify either --jar or --function-type, not both");
} Try / catch
try {
functionsCmd.run();
} catch (ParameterException e) {
if (e.getMessage().contains("jar and function-type")) {
System.err.println("Choose one packaging mode: uploaded jar or built-in function-type.");
}
} Prevention
- In deploy scripts, branch explicitly: user-jar mode sets only --jar; builtin mode sets only --function-type.
- Initialize jar variables to null, not to a default jar path, in wrappers.
- Document the packaging choice per function so operators don't mix flags.
When it happens
Trigger: Running functions create/update with both --jar (or --py/--go plus jar semantics) and --function-type / --builtin set at the same time.
Common situations: Template scripts that always pass --jar, then get extended with --function-type for built-ins; defaults baked into wrapper scripts where the jar variable is set to a non-null default.
Related errors
- You must specify either a Fully Qualified Function Name (FQF
- You must specify a name for the function or a Fully Qualifie
- No Function name specified
- Fully qualified function names (FQFNs) must be of the form t
- No Function Classname specified
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/bc6c7e4bc8f7dcdc.
Report an issue: GitHub.