{"record":{"id":"73e96b35c702c2bd","repo":"apache/pulsar","slug":"componenttype-s-doesn-t-exist","errorCode":null,"errorMessage":"<componentType> %s doesn't exist","messagePattern":"<componentType> (.+?) doesn't exist","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":565,"sourceCode":"\n        // validate parameters\n        try {\n            validateGetFunctionRequestParams(tenant, namespace, componentName, componentType);\n        } catch (IllegalArgumentException e) {\n            log.error().attr(\"componentType\", ComponentTypeUtils.toString(componentType)).attr(\"tenant\", tenant)\n\n                    .attr(\"namespace\", namespace).attr(\"componentName\", componentName).exception(e)\n\n                    .log(\"Invalid get request @ / / /\");\n            throw new RestException(Status.BAD_REQUEST, e.getMessage());\n        }\n\n        FunctionMetaDataManager functionMetaDataManager = worker().getFunctionMetaDataManager();\n        if (!functionMetaDataManager.containsFunction(tenant, namespace, componentName)) {\n            log.error().attr(\"componentType\", ComponentTypeUtils.toString(componentType)).attr(\"tenant\", tenant)\n\n                    .attr(\"namespace\", namespace).attr(\"componentName\", componentName).log(\"does not exist @ / / /\");\n            throw new RestException(Status.NOT_FOUND,\n                    String.format(ComponentTypeUtils.toString(componentType) + \" %s doesn't exist\", componentName));\n        }\n        FunctionMetaData functionMetaData =\n                functionMetaDataManager.getFunctionMetaData(tenant, namespace, componentName);\n        if (!InstanceUtils.calculateSubjectType(functionMetaData.getFunctionDetails()).equals(componentType)) {\n            log.error().attr(\"tenant\", tenant).attr(\"namespace\", namespace).attr(\"componentName\", componentName)\n\n                    .attr(\"componentType\", ComponentTypeUtils.toString(componentType)).log(\"/ / is not a\");\n            throw new RestException(Status.NOT_FOUND,\n                    String.format(ComponentTypeUtils.toString(componentType) + \" %s doesn't exist\", componentName));\n        }\n        return FunctionConfigUtils.convertFromDetails(functionMetaData.getFunctionDetails());\n    }\n\n    @Override\n    public void stopFunctionInstance(final String tenant,\n                                     final String namespace,\n                                     final String componentName,","sourceCodeStart":547,"sourceCodeEnd":583,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java#L547-L583","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm existence with the namespace-level list endpoint (GET .../functions/{tenant}/{namespace}) before fetching a single function.","Verify tenant/namespace/functionName spelling and that the function was deployed to this cluster.","Add retry/backoff if fetching immediately after a registration that may not have propagated."],"exampleFix":"// before\nFunctionConfig cfg = admin.functions().getFunction(t, n, fn); // 404 if not yet deployed\n// after\nList<String> fns = admin.functions().getFunctions(t, n);\nif (fns.contains(fn)) { FunctionConfig cfg = admin.functions().getFunction(t, n, fn); }","handlingStrategy":"validation","validationCode":"boolean exists = admin.functions().getFunctions(tenant, namespace).contains(functionName);\nif (!exists) return null; // or Optional.empty() instead of triggering 404","typeGuard":null,"tryCatchPattern":"try { return admin.functions().getFunction(t, n, fn); }\ncatch (PulsarAdminException.NotFoundException e) { return Optional.empty(); }","preventionTips":["Wait for deployment completion (status endpoint) before fetching configs.","Verify the function was deployed to the cluster you are querying.","Retry with backoff immediately after registration to tolerate metadata propagation."],"tags":["pulsar-functions","http-404","not-found","rest-api"],"backgroundTag":"resource-not-found-404","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"}