{"record":{"id":"bfe5f6ab6f171c23","repo":"apache/pulsar","slug":"s-s-doesn-t-exist-bfe5f6","errorCode":null,"errorMessage":"%s %s doesn't exist","messagePattern":"(.+?) (.+?) doesn't exist","errorType":"http","errorClass":"RestException","httpStatus":400,"severity":"error","filePath":"pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java","lineNumber":292,"sourceCode":"            throw new RestException(Response.Status.BAD_REQUEST, \"Tenant is not provided\");\n        }\n        if (namespace == null) {\n            throw new RestException(Response.Status.BAD_REQUEST, \"Namespace is not provided\");\n        }\n        if (functionName == null) {\n            throw new RestException(Response.Status.BAD_REQUEST, \"Function name is not provided\");\n        }\n        if (functionConfig == null) {\n            throw new RestException(Response.Status.BAD_REQUEST, \"Function config is not provided\");\n        }\n\n        throwRestExceptionIfUnauthorizedForNamespace(tenant, namespace, functionName, \"update\",\n                authParams);\n\n        FunctionMetaDataManager functionMetaDataManager = worker().getFunctionMetaDataManager();\n\n        if (!functionMetaDataManager.containsFunction(tenant, namespace, functionName)) {\n            throw new RestException(Response.Status.BAD_REQUEST, String.format(\"%s %s doesn't exist\",\n                    ComponentTypeUtils.toString(componentType), functionName));\n        }\n\n        FunctionMetaData existingComponent = functionMetaDataManager\n                .getFunctionMetaData(tenant, namespace, functionName);\n\n        if (!InstanceUtils.calculateSubjectType(existingComponent.getFunctionDetails()).equals(componentType)) {\n            log.error().attr(\"tenant\", tenant).attr(\"namespace\", namespace).attr(\"componentName\", functionName)\n\n                    .attr(\"componentType\", ComponentTypeUtils.toString(componentType)).log(\"/ / is not a\");\n            throw new RestException(Response.Status.NOT_FOUND, String.format(\"%s %s doesn't exist\",\n                    ComponentTypeUtils.toString(componentType), functionName));\n        }\n\n        FunctionConfig existingFunctionConfig = FunctionConfigUtils\n                .convertFromDetails(existingComponent.getFunctionDetails());\n        // The rest end points take precedence over whatever is there in function config\n        functionConfig.setTenant(tenant);","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java#L274-L310","documentation":"FunctionsImpl.updateFunction checks FunctionMetaDataManager.containsFunction before updating. If no component with the given tenant/namespace/name exists in the worker's metadata, it throws HTTP 400 with '<componentType> <name> doesn't exist'. Note the type in the message comes from the REQUEST (componentType), which may not match what actually exists.","triggerScenarios":"Update (PUT) against a function name that was never registered, was deleted, has a typo in the name, or exists in a different tenant/namespace; cluster where the metadata store hasn't replicated the registration yet.","commonSituations":"CI pipelines updating functions before the register step succeeded; environment drift (name registered in staging but not prod); typo'd names in deployment scripts; querying the wrong worker cluster.","solutions":["List existing functions (GET /admin/v3/functions/{tenant}/{namespace}) to confirm the exact name.","Register the function first if it doesn't exist, or switch the call to registerFunction.","Verify tenant/namespace spelling and that you're hitting the intended cluster.","Check for the component under the matching type endpoint (functions vs sources vs sinks)."],"exampleFix":"// before\nadmin.functions().updateFunction(\"t\", \"ns\", \"myFunc\", cfg, null); // never registered\n// after\nif (!admin.functions().getFunctions(\"t\", \"ns\").contains(\"myFunc\")) {\n    admin.functions().createFunction(cfg, null); // register first\n} else {\n    admin.functions().updateFunction(\"t\", \"ns\", \"myFunc\", cfg, null);\n}","handlingStrategy":"validation","validationCode":"boolean exists = admin.functions().getFunctions(tenant, namespace).contains(functionName);\nif (!exists) {\n    throw new IllegalStateException(functionName + \" not registered in \" + tenant + \"/\" + namespace + \"; register first\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    admin.functions().updateFunction(t, ns, fn, cfg, null);\n} catch (PulsarAdminException e) {\n    if (e.getStatusCode() == 400 && e.getMessage().contains(\"doesn't exist\")) {\n        admin.functions().createFunction(cfg, null); // register-then-update fallback\n    } else { throw e; }\n}","preventionTips":["Guarantee ordering in pipelines: registration step must succeed before update steps.","Verify names/tenants/namespaces against a listing before updating.","Confirm you are pointing at the intended cluster/environment."],"tags":["rest-api","pulsar-functions","not-found","http-400"],"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"}