apache/pulsar · error · IllegalArgumentException

No Function name specified

Error message

No Function name specified

What it means

validateFunctionConfigs tries Utils.inferMissingFunctionName to derive the function name (typically from the jar filename) and, if the name is still empty, throws IllegalArgumentException 'No Function name specified'. Every function must have a resolvable name in its FunctionConfig.

Source

Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java:708

            }

            // check if configs are valid
            validateFunctionConfigs(functionConfig);
        }

        protected void validateFunctionConfigs(FunctionConfig functionConfig) {
            // go doesn't need className
            if (functionConfig.getPy() != null
                    || (functionConfig.getJar() != null && !functionConfig.getJar().startsWith("builtin://"))) {
                if (StringUtils.isEmpty(functionConfig.getClassName())) {
                    throw new ParameterException("No Function Classname specified");
                }
            }
            if (StringUtils.isEmpty(functionConfig.getName())) {
                org.apache.pulsar.common.functions.Utils.inferMissingFunctionName(functionConfig);
            }
            if (StringUtils.isEmpty(functionConfig.getName())) {
                throw new IllegalArgumentException("No Function name specified");
            }
            if (StringUtils.isEmpty(functionConfig.getTenant())) {
                org.apache.pulsar.common.functions.Utils.inferMissingTenant(functionConfig);
            }
            if (StringUtils.isEmpty(functionConfig.getNamespace())) {
                org.apache.pulsar.common.functions.Utils.inferMissingNamespace(functionConfig);
            }

            if (isNotBlank(functionConfig.getJar()) && isNotBlank(functionConfig.getPy())
                    && isNotBlank(functionConfig.getGo())) {
                throw new ParameterException("Either a Java jar or a Python file or a Go executable binary needs to"
                        + " be specified for the function. Cannot specify both.");
            }

            if (isBlank(functionConfig.getJar()) && isBlank(functionConfig.getPy())
                    && isBlank(functionConfig.getGo())) {
                throw new ParameterException("Either a Java jar or a Python file or a Go executable binary needs to"
                        + " be specified for the function. Please specify one.");

View on GitHub (pinned to 820761864e)

Solutions

  1. Pass --name explicitly with the function name.
  2. Or use --fqfn tenant/namespace/name, which sets the name from its third segment.
  3. If relying on inference, pass a --jar with a usable file name so inferMissingFunctionName can derive the name.

Example fix

// before
pulsar-admin functions create --tenant public --namespace default --classname org.ex.MyFn --function-type Exclamation
// after
pulsar-admin functions create --tenant public --namespace default --name ex --classname org.ex.MyFn --function-type Exclamation
Defensive patterns

Strategy: validation

Validate before calling

if (StringUtils.isEmpty(name) && (fqfn == null || fqfn.split("/").length != 3) && jarFile == null) {
    throw new IllegalArgumentException("Function name required: pass --name, --fqfn, or a jar to infer from");
}

Try / catch

try {
    functionsCmd.run();
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("Function name")) {
        System.err.println("Add --name (or --fqfn tenant/namespace/name).");
    }
}

Prevention

When it happens

Trigger: Functions create/update where neither --name nor an inferable source (e.g. a jar file path whose filename can serve as the name) is provided, leaving FunctionConfig.name empty after inference.

Common situations: Using --function-type or builtin:// jars with no --name (nothing to infer from), scripts building configs programmatically without setting the name, or typos in the --name flag.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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