{"record":{"id":"4ef056a96f16a5fe","repo":"apache/pulsar","slug":"function-name-is-not-provided-4ef056","errorCode":null,"errorMessage":"Function name is not provided","messagePattern":"Function name is not provided","errorType":"validation","errorClass":"RestException","httpStatus":400,"severity":"error","filePath":"pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java","lineNumber":98,"sourceCode":"                                 final String functionName,\n                                 final InputStream uploadedInputStream,\n                                 final FormDataContentDisposition fileDetail,\n                                 final String functionPkgUrl,\n                                 final FunctionConfig functionConfig,\n                                 final AuthenticationParameters authParams) {\n\n        if (!isWorkerServiceAvailable()) {\n            throwUnavailableException();\n        }\n\n        if (tenant == null) {\n            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, \"register\", authParams);\n\n        try {\n            // Check tenant exists\n            worker().getBrokerAdmin().tenants().getTenantInfo(tenant);\n\n            String qualifiedNamespace = tenant + \"/\" + namespace;\n            List<String> namespaces = worker().getBrokerAdmin().namespaces().getNamespaces(tenant);\n            if (namespaces != null && !namespaces.contains(qualifiedNamespace)) {\n                String qualifiedNamespaceWithCluster = String.format(\"%s/%s/%s\", tenant,\n                        worker().getWorkerConfig().getPulsarFunctionsCluster(), namespace);\n                if (!namespaces.contains(qualifiedNamespaceWithCluster)) {\n                    log.error().attr(\"tenant\", tenant).attr(\"namespace\", namespace).attr(\"componentName\", functionName)","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java#L80-L116","documentation":"Register-function request validation in FunctionsImpl.registerFunction: mandatory request parameters are null (tenant checked first, function name among them) or the worker is unavailable, so the function registration REST call is rejected with a client error; the missing parameter in the request is the faulty input.","triggerScenarios":"POST /admin/v3/functions/{tenant}/{namespace}/{functionName} with an empty function-name path segment, or a registration call that omits the function name argument.","commonSituations":"Trailing-slash or empty segment in hand-built REST URLs; CLI flag --name missing; config object with FunctionConfig.setName never called.","solutions":["Set the name field in the function config"],"exampleFix":"// before\ncfg.setTenant(\"public\"); cfg.setNamespace(\"default\"); // name never set\n// after\ncfg.setTenant(\"public\"); cfg.setNamespace(\"default\"); cfg.setName(\"exclamation\");","handlingStrategy":"validation","validationCode":"if (cfg.getName() == null || cfg.getName().isEmpty()) throw new IllegalArgumentException(\"functionName required\");","typeGuard":"boolean hasFunctionName(FunctionConfig cfg) { return cfg != null && cfg.getName() != null && !cfg.getName().isEmpty(); }","tryCatchPattern":"try { admin.functions().createFunction(...); }\ncatch (PulsarAdminException e) {\n    if (e.getStatusCode() == 400 && String.valueOf(e.getMessage()).contains(\"Function name is not provided\")) {\n        // set name and resubmit\n    }\n}","preventionTips":["Always pass --name (CLI) and setName (config) together","Generate names deterministically in CI to avoid empty variables","Validate the final URL path contains a non-empty function name"],"tags":["pulsar-functions","rest-api","validation"],"backgroundTag":"missing-required-parameter","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}