{"record":{"id":"d7f38b9422284403","repo":"apache/pulsar","slug":"function-s-doesn-t-exist","errorCode":null,"errorMessage":"Function %s doesn't exist","messagePattern":"Function (.+?) 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":1127,"sourceCode":"\n        throwRestExceptionIfUnauthorizedForNamespace(tenant, namespace, functionName, \"trigger\", authParams);\n\n        // validate parameters\n        try {\n            validateTriggerRequestParams(tenant, namespace, functionName, topic, input, uploadedInputStream);\n        } catch (IllegalArgumentException e) {\n            log.error().attr(\"tenant\", tenant).attr(\"namespace\", namespace).attr(\"componentName\", functionName)\n\n                    .exception(e).log(\"Invalid trigger function 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(\"Function in trigger function does not exist @ / / /\");\n            throw new RestException(Status.NOT_FOUND, String.format(\"Function %s doesn't exist\", functionName));\n        }\n\n        FunctionMetaData functionMetaData = functionMetaDataManager.getFunctionMetaData(tenant, namespace,\n                functionName);\n\n        String inputTopicToWrite;\n        if (topic != null) {\n            inputTopicToWrite = topic;\n        } else if (functionMetaData.getFunctionDetails().getSource().getInputSpecsCount() == 1) {\n            String[] firstKey = new String[1];\n            functionMetaData.getFunctionDetails().getSource().forEachInputSpecs((k, v) -> firstKey[0] = k);\n            inputTopicToWrite = firstKey[0];\n        } else {\n            log.error().attr(\"tenant\", tenant).attr(\"namespace\", namespace).attr(\"componentName\", functionName)\n\n                    .log(\"Function in trigger function has more than 1 input topics @ / / /\");\n            throw new RestException(Status.BAD_REQUEST, \"Function in trigger function has more than 1 input topics\");\n        }","sourceCodeStart":1109,"sourceCodeEnd":1145,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java#L1109-L1145","documentation":"After validation, triggerFunction checks FunctionMetaDataManager.containsFunction. If no function with the given tenant/namespace/name exists in the worker's metadata, it returns HTTP 404 Not Found with 'Function <name> doesn't exist'. The trigger never reaches the topic machinery.","triggerScenarios":"POST trigger for a function name that was never submitted, was deleted, or is registered under a different tenant/namespace; also triggered while function metadata has not yet propagated to the worker handling the request.","commonSituations":"Typo in the function name; triggering in the wrong tenant/namespace; calling trigger immediately after submission before metadata sync; function deleted by a concurrent pipeline run.","solutions":["List functions in the tenant/namespace (GET /functions/{tenant}/{namespace}) and confirm the exact function name.","Correct tenant/namespace/functionName in the trigger URL — names are case-sensitive.","Retry after a short delay if the function was just submitted (metadata propagation).","Re-submit the function if it was deleted, then trigger again."],"exampleFix":"// before\ncurl -X POST --data-binary 'x' .../functions/public/default/exFunc  # wrong case\n// after\ncurl -X POST --data-binary 'x' .../functions/public/default/exfunc  # matches registered name","handlingStrategy":"validation","validationCode":"import java.util.List;\nstatic boolean functionExists(Functions functions, String t, String n, String fn) throws PulsarAdminException {\n  return functions.getFunctions(t, n).contains(fn);\n}","typeGuard":null,"tryCatchPattern":"try { trigger(...); }\ncatch (PulsarAdminException e) {\n  if (e.getResponseStatus() == 404)\n    throw new IllegalStateException(\"Function \" + fn + \" not registered in \" + t + \"/\" + n);\n  throw e;\n}","preventionTips":["Gate trigger steps in CI on a prior getFunctions listing","Add a retry-with-delay after function submission before triggering","Use constants/shared config for function names, never hand-typed strings"],"tags":["not-found","pulsar-functions","rest-api"],"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"}