{"record":{"id":"4c9d334eb7524b93","repo":"apache/pulsar","slug":"s-is-not-found","errorCode":null,"errorMessage":"'%s' is not found","messagePattern":"'(.+?)' is not found","errorType":"http","errorClass":"RestException","httpStatus":404,"severity":"error","filePath":"pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java","lineNumber":1269,"sourceCode":"            throwStateStoreUnvailableResponse();\n        }\n\n        // validate parameters\n        try {\n            validateFunctionStateParams(tenant, namespace, functionName, key);\n        } catch (IllegalArgumentException e) {\n            log.error().attr(\"tenant\", tenant).attr(\"namespace\", namespace).attr(\"componentName\", functionName)\n\n                    .attr(\"key\", key).exception(e).log(\"Invalid getFunctionState request @ / / / /\");\n            throw new RestException(Status.BAD_REQUEST, e.getMessage());\n        }\n\n        FunctionMetaDataManager functionMetaDataManager = worker().getFunctionMetaDataManager();\n        if (!functionMetaDataManager.containsFunction(tenant, namespace, functionName)) {\n            log.warn().attr(\"tenant\", tenant).attr(\"namespace\", namespace).attr(\"componentName\", functionName)\n\n                    .log(\"getFunctionState does not exist @ / / /\");\n            throw new RestException(Status.NOT_FOUND, String.format(\"'%s' is not found\", functionName));\n        }\n\n        try {\n            DefaultStateStore store = worker().getStateStoreProvider().getStateStore(tenant, namespace, functionName);\n            StateValue value = store.getStateValue(key);\n            if (value == null) {\n                throw new RestException(Status.NOT_FOUND, \"key '\" + key + \"' doesn't exist.\");\n            }\n            byte[] data = value.getValue();\n            if (data == null) {\n                throw new RestException(Status.NOT_FOUND, \"key '\" + key + \"' doesn't exist.\");\n            }\n\n            ByteBuffer buf = ByteBuffer.wrap(data);\n\n            Long number = null;\n            if (buf.remaining() == Long.BYTES) {\n                number = buf.getLong();","sourceCodeStart":1251,"sourceCodeEnd":1287,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java#L1251-L1287","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["List functions via GET /admin/v3/functions/{tenant}/{namespace} to confirm the exact name.","Re-deploy the function if it was deleted or never registered.","Verify tenant and namespace in the URL match the deployment.","If the function exists on other workers but 404s here, wait for metadata sync or check the function metadata topic / metadata store health."],"exampleFix":"// before\nGET /admin/v3/functions/public/default/my-funtion/state/counter  -> 404 'my-funtion' is not found\n\n// after (corrected name)\nGET /admin/v3/functions/public/default/my-function/state/counter","handlingStrategy":"validation","validationCode":"// Confirm the function exists before reading state\nconst fns = await admin.functions.list(tenant, namespace);\nif (!fns.includes(functionName)) {\n  throw new Error(`Function ${functionName} not deployed in ${tenant}/${namespace}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const state = await getState(tenant, ns, fn, key);\n} catch (e) {\n  if (e.status === 404 && e.message.includes(\"is not found\")) {\n    // function missing: list functions or deploy it before retrying\n  } else throw e;\n}","preventionTips":["Verify deployment with a functions list/get call before querying state.","Use the fully-qualified name components exactly as registered (watch for typos).","After deleting/redeploying functions, allow metadata sync before state queries."],"tags":["rest-api","not-found","functions","state"],"backgroundTag":"resource-not-found","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}