apache/pulsar · error · RestException

<componentType> %s doesn't exist

Error message

<componentType> %s doesn't exist

What it means

Thrown by getFunctionInfo when the worker has no function metadata for the given tenant/namespace/name. Unlike deregisterFunction's variant, the message string is built by prefixing the component type directly (e.g. "Function f doesn't exist") and returned as HTTP 404.

Source

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

        // validate parameters
        try {
            validateGetFunctionRequestParams(tenant, namespace, componentName, componentType);
        } catch (IllegalArgumentException e) {
            log.error().attr("componentType", ComponentTypeUtils.toString(componentType)).attr("tenant", tenant)

                    .attr("namespace", namespace).attr("componentName", componentName).exception(e)

                    .log("Invalid get request @ / / /");
            throw new RestException(Status.BAD_REQUEST, e.getMessage());
        }

        FunctionMetaDataManager functionMetaDataManager = worker().getFunctionMetaDataManager();
        if (!functionMetaDataManager.containsFunction(tenant, namespace, componentName)) {
            log.error().attr("componentType", ComponentTypeUtils.toString(componentType)).attr("tenant", tenant)

                    .attr("namespace", namespace).attr("componentName", componentName).log("does not exist @ / / /");
            throw new RestException(Status.NOT_FOUND,
                    String.format(ComponentTypeUtils.toString(componentType) + " %s doesn't exist", componentName));
        }
        FunctionMetaData functionMetaData =
                functionMetaDataManager.getFunctionMetaData(tenant, namespace, componentName);
        if (!InstanceUtils.calculateSubjectType(functionMetaData.getFunctionDetails()).equals(componentType)) {
            log.error().attr("tenant", tenant).attr("namespace", namespace).attr("componentName", componentName)

                    .attr("componentType", ComponentTypeUtils.toString(componentType)).log("/ / is not a");
            throw new RestException(Status.NOT_FOUND,
                    String.format(ComponentTypeUtils.toString(componentType) + " %s doesn't exist", componentName));
        }
        return FunctionConfigUtils.convertFromDetails(functionMetaData.getFunctionDetails());
    }

    @Override
    public void stopFunctionInstance(final String tenant,
                                     final String namespace,
                                     final String componentName,

View on GitHub (pinned to 820761864e)

Solutions

  1. Confirm existence with the namespace-level list endpoint (GET .../functions/{tenant}/{namespace}) before fetching a single function.
  2. Verify tenant/namespace/functionName spelling and that the function was deployed to this cluster.
  3. Add retry/backoff if fetching immediately after a registration that may not have propagated.

Example fix

// before
FunctionConfig cfg = admin.functions().getFunction(t, n, fn); // 404 if not yet deployed
// after
List<String> fns = admin.functions().getFunctions(t, n);
if (fns.contains(fn)) { FunctionConfig cfg = admin.functions().getFunction(t, n, fn); }
Defensive patterns

Strategy: validation

Validate before calling

boolean exists = admin.functions().getFunctions(tenant, namespace).contains(functionName);
if (!exists) return null; // or Optional.empty() instead of triggering 404

Try / catch

try { return admin.functions().getFunction(t, n, fn); }
catch (PulsarAdminException.NotFoundException e) { return Optional.empty(); }

Prevention

When it happens

Trigger: GET /admin/v3/functions/{tenant}/{namespace}/{functionName} when functionMetaDataManager.containsFunction(...) is false — the function was never registered, was already deleted, or this worker hasn't received the metadata yet.

Common situations: Polling for a function before its registration completes; reading state after an unsuccessful deploy; wrong namespace/tenant in the URL; multi-cluster setups where the function only exists elsewhere.

Related errors


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