apache/pulsar · error · RestException

%s %s doesn't exist

Error message

%s %s doesn't exist

What it means

FunctionsImpl.updateFunction checks FunctionMetaDataManager.containsFunction before updating. If no component with the given tenant/namespace/name exists in the worker's metadata, it throws HTTP 400 with '<componentType> <name> doesn't exist'. Note the type in the message comes from the REQUEST (componentType), which may not match what actually exists.

Source

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

            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, "update",
                authParams);

        FunctionMetaDataManager functionMetaDataManager = worker().getFunctionMetaDataManager();

        if (!functionMetaDataManager.containsFunction(tenant, namespace, functionName)) {
            throw new RestException(Response.Status.BAD_REQUEST, String.format("%s %s doesn't exist",
                    ComponentTypeUtils.toString(componentType), functionName));
        }

        FunctionMetaData existingComponent = functionMetaDataManager
                .getFunctionMetaData(tenant, namespace, functionName);

        if (!InstanceUtils.calculateSubjectType(existingComponent.getFunctionDetails()).equals(componentType)) {
            log.error().attr("tenant", tenant).attr("namespace", namespace).attr("componentName", functionName)

                    .attr("componentType", ComponentTypeUtils.toString(componentType)).log("/ / is not a");
            throw new RestException(Response.Status.NOT_FOUND, String.format("%s %s doesn't exist",
                    ComponentTypeUtils.toString(componentType), functionName));
        }

        FunctionConfig existingFunctionConfig = FunctionConfigUtils
                .convertFromDetails(existingComponent.getFunctionDetails());
        // The rest end points take precedence over whatever is there in function config
        functionConfig.setTenant(tenant);

View on GitHub (pinned to 820761864e)

Solutions

  1. List existing functions (GET /admin/v3/functions/{tenant}/{namespace}) to confirm the exact name.
  2. Register the function first if it doesn't exist, or switch the call to registerFunction.
  3. Verify tenant/namespace spelling and that you're hitting the intended cluster.
  4. Check for the component under the matching type endpoint (functions vs sources vs sinks).

Example fix

// before
admin.functions().updateFunction("t", "ns", "myFunc", cfg, null); // never registered
// after
if (!admin.functions().getFunctions("t", "ns").contains("myFunc")) {
    admin.functions().createFunction(cfg, null); // register first
} else {
    admin.functions().updateFunction("t", "ns", "myFunc", cfg, null);
}
Defensive patterns

Strategy: validation

Validate before calling

boolean exists = admin.functions().getFunctions(tenant, namespace).contains(functionName);
if (!exists) {
    throw new IllegalStateException(functionName + " not registered in " + tenant + "/" + namespace + "; register first");
}

Try / catch

try {
    admin.functions().updateFunction(t, ns, fn, cfg, null);
} catch (PulsarAdminException e) {
    if (e.getStatusCode() == 400 && e.getMessage().contains("doesn't exist")) {
        admin.functions().createFunction(cfg, null); // register-then-update fallback
    } else { throw e; }
}

Prevention

When it happens

Trigger: Update (PUT) against a function name that was never registered, was deleted, has a typo in the name, or exists in a different tenant/namespace; cluster where the metadata store hasn't replicated the registration yet.

Common situations: CI pipelines updating functions before the register step succeeded; environment drift (name registered in staging but not prod); typo'd names in deployment scripts; querying the wrong worker cluster.

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