apache/pulsar · error · IllegalArgumentException

No Function %s found

Error message

No Function %s found

What it means

IllegalArgumentException (surfaced as HTTP 400 by the REST layer) thrown by validateUpdateRequestParams when functionConfig.getJar() references a built-in archive (builtin://<name>) but the worker's FunctionsManager has no registered built-in function with that name. The lookup functionsManager.getFunction(archive) returns null and validation aborts.

Source

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

        functionConfig.setNamespace(namespace);
        functionConfig.setName(componentName);
        WorkerConfig workerConfig = worker().getWorkerConfig();
        FunctionConfigUtils.inferMissingArguments(
                functionConfig, workerConfig.isForwardSourceMessageProperty());

        String archive = functionConfig.getJar();
        ValidatableFunctionPackage functionPackage = null;
        // check if function is builtin and extract classloader
        if (!StringUtils.isEmpty(archive)) {
            if (archive.startsWith(org.apache.pulsar.common.functions.Utils.BUILTIN)) {
                archive = archive.replaceFirst("^builtin://", "");

                FunctionsManager functionsManager = worker().getFunctionsManager();
                FunctionArchive function = functionsManager.getFunction(archive);

                // check if builtin function exists
                if (function == null) {
                    throw new IllegalArgumentException(String.format("No Function %s found", archive));
                }
                functionPackage = function.getFunctionPackage();
            }
        }
        boolean shouldCloseFunctionPackage = false;
        try {
            if (functionConfig.getRuntime() == FunctionConfig.Runtime.JAVA) {
                // if function is not builtin, attempt to extract classloader from package file if it exists
                if (functionPackage == null && componentPackageFile != null) {
                    functionPackage =
                            new FunctionFilePackage(componentPackageFile, workerConfig.getNarExtractionDirectory(),
                                    workerConfig.getEnableClassloadingOfExternalFiles(), FunctionDefinition.class);
                    shouldCloseFunctionPackage = true;
                }

                if (functionPackage == null) {
                    throw new IllegalArgumentException("Function package is not provided");
                }

View on GitHub (pinned to 820761864e)

Solutions

  1. List available built-ins via GET /admin/v2/functions/builtin to see valid names, and correct the builtin:// name in the config.
  2. Install the missing nar file into the worker's functionsDirectory and call reloadBuiltInFunctions (as superuser).
  3. If the package is not meant to be built-in, upload the jar and pass its package URL instead of a builtin:// reference.

Example fix

// before
config.setJar("builtin://socket-sink"); // not installed
// after
config.setJar("builtin://socket"); // or upload custom jar and use its package URL
Defensive patterns

Strategy: validation

Validate before calling

String jar = functionConfig.getJar();
if (jar != null && jar.startsWith("builtin://")) {
    String name = jar.replaceFirst("^builtin://", "");
    boolean ok = listBuiltins().stream().anyMatch(d -> d.getName().equals(name));
    if (!ok) throw new IllegalArgumentException("builtin function not installed: " + name);
}

Try / catch

try {
    admin.registerFunction(cfg);
} catch (ApiException e) {
    if (e.code() == 400 && e.body().startsWith("No Function ")) {
        // correct builtin name or install nar, then reloadBuiltInFunctions
    }
}

Prevention

When it happens

Trigger: registerFunction/updateFunction with a config whose jar is builtin://xyz where xyz is misspelled, not installed on the worker's functionsDirectory, or not visible after a failed reloadBuiltinFunctions.

Common situations: Function deployed against a worker whose narExtractionDirectory/functionsDirectory lacks the connector nar; built-in name differs between Pulsar versions (renames/removals); typo such as builtin://socket-source vs builtin://socket; workers started without --functionsDirectory containing the nar files.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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