apache/pulsar · error · RestException

'%s' is not found

Error message

'%s' is not found

What it means

Before reading function state, the worker's FunctionMetaDataManager checks whether the named function exists in the cluster. If not, it throws a 404 RestException formatted as "'<functionName>' is not found". This means no function with that fully-qualified name is registered on this worker's metadata topic.

Source

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

            throwStateStoreUnvailableResponse();
        }

        // validate parameters
        try {
            validateFunctionStateParams(tenant, namespace, functionName, key);
        } catch (IllegalArgumentException e) {
            log.error().attr("tenant", tenant).attr("namespace", namespace).attr("componentName", functionName)

                    .attr("key", key).exception(e).log("Invalid getFunctionState request @ / / / /");
            throw new RestException(Status.BAD_REQUEST, e.getMessage());
        }

        FunctionMetaDataManager functionMetaDataManager = worker().getFunctionMetaDataManager();
        if (!functionMetaDataManager.containsFunction(tenant, namespace, functionName)) {
            log.warn().attr("tenant", tenant).attr("namespace", namespace).attr("componentName", functionName)

                    .log("getFunctionState does not exist @ / / /");
            throw new RestException(Status.NOT_FOUND, String.format("'%s' is not found", functionName));
        }

        try {
            DefaultStateStore store = worker().getStateStoreProvider().getStateStore(tenant, namespace, functionName);
            StateValue value = store.getStateValue(key);
            if (value == null) {
                throw new RestException(Status.NOT_FOUND, "key '" + key + "' doesn't exist.");
            }
            byte[] data = value.getValue();
            if (data == null) {
                throw new RestException(Status.NOT_FOUND, "key '" + key + "' doesn't exist.");
            }

            ByteBuffer buf = ByteBuffer.wrap(data);

            Long number = null;
            if (buf.remaining() == Long.BYTES) {
                number = buf.getLong();

View on GitHub (pinned to 820761864e)

Solutions

  1. List functions via GET /admin/v3/functions/{tenant}/{namespace} to confirm the exact name.
  2. Re-deploy the function if it was deleted or never registered.
  3. Verify tenant and namespace in the URL match the deployment.
  4. If the function exists on other workers but 404s here, wait for metadata sync or check the function metadata topic / metadata store health.

Example fix

// before
GET /admin/v3/functions/public/default/my-funtion/state/counter  -> 404 'my-funtion' is not found

// after (corrected name)
GET /admin/v3/functions/public/default/my-function/state/counter
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the function exists before reading state
const fns = await admin.functions.list(tenant, namespace);
if (!fns.includes(functionName)) {
  throw new Error(`Function ${functionName} not deployed in ${tenant}/${namespace}`);
}

Try / catch

try {
  const state = await getState(tenant, ns, fn, key);
} catch (e) {
  if (e.status === 404 && e.message.includes("is not found")) {
    // function missing: list functions or deploy it before retrying
  } else throw e;
}

Prevention

When it happens

Trigger: GET .../functions/{tenant}/{namespace}/{functionName}/state/{key} where containsFunction(tenant, namespace, functionName) returns false — the function was never registered, was deleted, or the worker has not yet synced metadata.

Common situations: Typo in the function name; querying the wrong tenant/namespace; calling state API before the function finished deploying; function deleted by another operator; worker metadata lag after a zk/metadata-store hiccup.

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