{"record":{"id":"8527a30ae8f5903c","repo":"apache/pulsar","slug":"s-s-doesn-t-exist","errorCode":null,"errorMessage":"%s %s doesn't exist","messagePattern":"(.+?) (.+?) 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":474,"sourceCode":"        try {\n            validateDeregisterRequestParams(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 deregister 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)\n\n                    .log(\"to deregister does not exist @ / / /\");\n            throw new RestException(Status.NOT_FOUND,\n                    String.format(\"%s %s doesn't exist\", ComponentTypeUtils.toString(componentType), componentName));\n        }\n        FunctionMetaData functionMetaData =\n                functionMetaDataManager.getFunctionMetaData(tenant, namespace, componentName);\n\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(\"%s %s doesn't exist\", ComponentTypeUtils.toString(componentType), componentName));\n        }\n\n        FunctionMetaData newVersionedMetaData =\n                FunctionMetaDataUtils.incrMetadataVersion(functionMetaData, functionMetaData);\n        internalProcessFunctionRequest(newVersionedMetaData.getFunctionDetails().getTenant(),\n                newVersionedMetaData.getFunctionDetails().getNamespace(),\n                newVersionedMetaData.getFunctionDetails().getName(),","sourceCodeStart":456,"sourceCodeEnd":492,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java#L456-L492","documentation":"Thrown by deregisterFunction when the Functions worker's FunctionMetaDataManager has no record of a component with the given tenant/namespace/name. The worker treats any unknown component as NOT_FOUND, prefixed with the component type (Function, Sink, Source) resolved from the requested componentType. It is a server-side 404 surfaced as a RestException.","triggerScenarios":"Calling DELETE /admin/v3/functions/{tenant}/{namespace}/{functionName} (or sink/source equivalents) when functionMetaDataManager.containsFunction(tenant, namespace, componentName) returns false — i.e. the function was never registered, already deleted, or the request hit a worker that hasn't yet synced the function metadata topic.","commonSituations":"Typo in the function name or tenant/namespace path; deleting a function twice; delete racing with another worker's metadata-topic replication delay; cluster where the function exists only on another cluster's workers; cleanup scripts firing after an operator already removed the function.","solutions":["Verify the function exists first: GET /admin/v3/functions/{tenant}/{namespace}/{functionName} and confirm the exact tenant/namespace/name used in the delete call.","Correct typos in tenant, namespace, or componentName in the request path.","Retry after the metadata has propagated; if hitting a worker that lacks the record, retry against another worker or wait for the function metadata topic to sync.","Treat HTTP 404 as idempotent success in automation that deletes functions."],"exampleFix":"// before\ndelFunction(tenant, namespace, fn); // throws 404 if already gone\n// after\nif (admin.functions().getFunction(tenant, namespace, fn) != null) {\n    delFunction(tenant, namespace, fn);\n} // or catch NotFoundException and treat as success","handlingStrategy":"validation","validationCode":"boolean exists = admin.functions().getFunctions(tenant, namespace).contains(functionName);\nif (!exists) { /* skip delete or log-and-continue */ }","typeGuard":null,"tryCatchPattern":"try { admin.functions().deleteFunction(t, n, fn); }\ncatch (PulsarAdminException.NotFoundException e) { log.info(\"already deleted: {}\", fn); }","preventionTips":["List functions for the namespace before deleting by name.","Make delete idempotent: treat 404 as success in cleanup jobs.","Single-source tenant/namespace/name constants instead of hand-typed paths."],"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"}