{"record":{"id":"66cc242ed5bedfac","repo":"apache/pulsar","slug":"namespace-is-not-provided-66cc24","errorCode":null,"errorMessage":"Namespace is not provided","messagePattern":"Namespace 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":95,"sourceCode":"    @Override\n    public void registerFunction(final String tenant,\n                                 final String namespace,\n                                 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,","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java#L77-L113","documentation":"registerFunction rejects the request with HTTP 400 when the namespace parameter is null. Tenant/namespace/functionName form the function's fully qualified name, so all three must be present before any further validation.","triggerScenarios":"POST /admin/v3/functions/{tenant}/{namespace}/{functionName} with a null/missing namespace segment, or FunctionConfig created without setNamespace().","commonSituations":"URL template with a missing path segment; JSON config missing namespace; variables not expanded in deployment scripts.","solutions":["Provide the namespace in the URL path and FunctionConfig (commonly 'default')","Verify tenant/namespace exist via 'pulsar-admin namespaces list <tenant>'","Fix script/tooling that builds the request so the namespace variable is expanded"],"exampleFix":"// before\nadmin.functions().createFunction(tenant, null, fnName, pkg, cfg, null);\n// after\nadmin.functions().createFunction(tenant, \"default\", fnName, pkg, cfg, null);","handlingStrategy":"validation","validationCode":"if (cfg.getNamespace() == null || cfg.getNamespace().isEmpty()) throw new IllegalArgumentException(\"namespace required\");","typeGuard":"boolean hasNamespace(FunctionConfig cfg) { return cfg != null && cfg.getNamespace() != null && !cfg.getNamespace().isEmpty(); }","tryCatchPattern":"try { admin.functions().createFunction(...); }\ncatch (PulsarAdminException e) {\n    if (e.getStatusCode() == 400 && String.valueOf(e.getMessage()).contains(\"Namespace is not provided\")) {\n        // set namespace (e.g. \"default\") and resubmit\n    }\n}","preventionTips":["Default namespace to \"default\" in tooling when unset","Assert all three name components before registration","Log the fully qualified name tenant/namespace/name at submit time"],"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"}