apache/pulsar · error · RestException

Function name is not provided

Error message

Function name is not provided

What it means

Register-function request validation in FunctionsImpl.registerFunction: mandatory request parameters are null (tenant checked first, function name among them) or the worker is unavailable, so the function registration REST call is rejected with a client error; the missing parameter in the request is the faulty input.

Source

Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java:98

                                 final String functionName,
                                 final InputStream uploadedInputStream,
                                 final FormDataContentDisposition fileDetail,
                                 final String functionPkgUrl,
                                 final FunctionConfig functionConfig,
                                 final AuthenticationParameters authParams) {

        if (!isWorkerServiceAvailable()) {
            throwUnavailableException();
        }

        if (tenant == null) {
            throw new RestException(Response.Status.BAD_REQUEST, "Tenant is not provided");
        }
        if (namespace == null) {
            throw new RestException(Response.Status.BAD_REQUEST, "Namespace is not provided");
        }
        if (functionName == null) {
            throw new RestException(Response.Status.BAD_REQUEST, "Function name is not provided");
        }
        if (functionConfig == null) {
            throw new RestException(Response.Status.BAD_REQUEST, "Function config is not provided");
        }

        throwRestExceptionIfUnauthorizedForNamespace(tenant, namespace, functionName, "register", authParams);

        try {
            // Check tenant exists
            worker().getBrokerAdmin().tenants().getTenantInfo(tenant);

            String qualifiedNamespace = tenant + "/" + namespace;
            List<String> namespaces = worker().getBrokerAdmin().namespaces().getNamespaces(tenant);
            if (namespaces != null && !namespaces.contains(qualifiedNamespace)) {
                String qualifiedNamespaceWithCluster = String.format("%s/%s/%s", tenant,
                        worker().getWorkerConfig().getPulsarFunctionsCluster(), namespace);
                if (!namespaces.contains(qualifiedNamespaceWithCluster)) {
                    log.error().attr("tenant", tenant).attr("namespace", namespace).attr("componentName", functionName)

View on GitHub (pinned to 820761864e)

Solutions

  1. Set the name field in the function config

Example fix

// before
cfg.setTenant("public"); cfg.setNamespace("default"); // name never set
// after
cfg.setTenant("public"); cfg.setNamespace("default"); cfg.setName("exclamation");
Defensive patterns

Strategy: validation

Validate before calling

if (cfg.getName() == null || cfg.getName().isEmpty()) throw new IllegalArgumentException("functionName required");

Type guard

boolean hasFunctionName(FunctionConfig cfg) { return cfg != null && cfg.getName() != null && !cfg.getName().isEmpty(); }

Try / catch

try { admin.functions().createFunction(...); }
catch (PulsarAdminException e) {
    if (e.getStatusCode() == 400 && String.valueOf(e.getMessage()).contains("Function name is not provided")) {
        // set name and resubmit
    }
}

Prevention

When it happens

Trigger: POST /admin/v3/functions/{tenant}/{namespace}/{functionName} with an empty function-name path segment, or a registration call that omits the function name argument.

Common situations: Trailing-slash or empty segment in hand-built REST URLs; CLI flag --name missing; config object with FunctionConfig.setName never called.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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