apache/pulsar · error · RuntimeException

You must specify a name for the function or a Fully Qualifie

Error message

You must specify a name for the function or a Fully Qualified Function Name (FQFN)

What it means

In the else branch of processArguments, after defaulting tenant and namespace, the function name must still be present; if functionName is null (and no --fqfn was given) a RuntimeException is thrown. Every function operation needs an identifiable name.

Source

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

            } else if (usesFqfn) {
                // If the --fqfn flag is used, parse tenant, namespace, and name using that flag
                String[] fqfnParts = fqfn.split("/");
                if (fqfnParts.length != 3) {
                    throw new RuntimeException(
                            "Fully qualified function names (FQFNs) must be of the form tenant/namespace/name");
                }
                tenant = fqfnParts[0];
                namespace = fqfnParts[1];
                functionName = fqfnParts[2];
            } else {
                if (tenant == null) {
                    tenant = PUBLIC_TENANT;
                }
                if (namespace == null) {
                    namespace = DEFAULT_NAMESPACE;
                }
                if (null == functionName) {
                    throw new RuntimeException(
                            "You must specify a name for the function or a Fully Qualified Function Name (FQFN)");
                }
            }
        }
    }

    /**
     * Commands that require a function config.
     */
    @Getter
    abstract class FunctionDetailsCommand extends BaseCommand {
        @Option(names = "--fqfn", description = "The Fully Qualified Function Name (FQFN) for the function"
                + " #Java, Python")
        protected String fqfn;
        @Option(names = "--tenant", description = "The tenant of a Pulsar Function #Java, Python, Go")
        protected String tenant;
        @Option(names = "--namespace", description = "The namespace of a Pulsar Function #Java, Python, Go")
        protected String namespace;

View on GitHub (pinned to 820761864e)

Solutions

  1. Add --name (or --function-name on some subcommands) with the function name.
  2. Or identify the function with --fqfn tenant/namespace/name instead.
  3. If the name should come from the function config, ensure the config file used with --function-config contains a name.

Example fix

// before
pulsar-admin functions create --tenant public --namespace default --jar my.jar --classname org.ex.MyFn
// after
pulsar-admin functions create --tenant public --namespace default --name myfunc --jar my.jar --classname org.ex.MyFn
Defensive patterns

Strategy: validation

Validate before calling

if (fqfn == null && functionName == null) {
    throw new IllegalArgumentException("Provide --name (or --fqfn) for the function");
}

Try / catch

try {
    cmd.run();
} catch (RuntimeException e) {
    if (e.getMessage().contains("name for the function")) {
        System.err.println("Add --name or use --fqfn tenant/namespace/name.");
    }
}

Prevention

When it happens

Trigger: Running a functions subcommand with only --tenant (and optionally --namespace), or with none of --tenant/--namespace/--name/--fqfn at all, so no name can be resolved.

Common situations: Omitting --name in scripts, assuming the jar filename supplies the name (it doesn't at this CLI parsing stage for all commands), or typos like --function-name instead of --name.

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/c820a074df3ac862. Report an issue: GitHub.