apache/pulsar · error · RestException

Function config is not provided

Error message

Function config is not provided

What it means

registerFunction rejects the request with HTTP 400 when the submitted FunctionConfig body is null. The config carries parallelism, resources, class name, topics, and other mandatory settings, so a null body cannot be processed.

Source

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

                                 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)

                            .attr("namespace3", namespace).log("/ / Namespace does not exist");
                    throw new RestException(Response.Status.BAD_REQUEST, "Namespace does not exist");

View on GitHub (pinned to 820761864e)

Solutions

  1. Send a complete FunctionConfig JSON body with Content-Type application/json
  2. Verify the client library call passes a non-null FunctionConfig
  3. Validate the config locally (tenant/namespace/name/className/parallelism) before submit

Example fix

// before
admin.functions().createFunction(tenant, ns, name, pkgUrl, null, null);
// after
FunctionConfig cfg = new FunctionConfig(); /* populate */
admin.functions().createFunction(tenant, ns, name, pkgUrl, cfg, null);
Defensive patterns

Strategy: validation

Validate before calling

java.util.Objects.requireNonNull(cfg, "FunctionConfig must not be null");

Type guard

boolean hasConfig(FunctionConfig cfg) { return cfg != null; }

Try / catch

try { admin.functions().createFunction(...); }
catch (PulsarAdminException e) {
    if (e.getStatusCode() == 400 && String.valueOf(e.getMessage()).contains("Function config is not provided")) {
        // rebuild and send a populated FunctionConfig body
    }
}

Prevention

When it happens

Trigger: POST to the functions endpoint with an empty/missing JSON body, or calling the admin API with null for the FunctionConfig argument.

Common situations: HTTP client sending no body or wrong Content-Type so the config fails to deserialize to null; programmatic call passing null config.

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