{"record":{"id":"d4ca68356c4d2c04","repo":"apache/pulsar","slug":"source-name-is-not-provided","errorCode":null,"errorMessage":"Source name is not provided","messagePattern":"Source name is not provided","errorType":"http","errorClass":"RestException","httpStatus":400,"severity":"warning","filePath":"pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java","lineNumber":96,"sourceCode":"                               final String sourceName,\n                               final InputStream uploadedInputStream,\n                               final FormDataContentDisposition fileDetail,\n                               final String sourcePkgUrl,\n                               final SourceConfig sourceConfig,\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 (sourceName == null) {\n            throw new RestException(Response.Status.BAD_REQUEST, \"Source name is not provided\");\n        }\n        if (sourceConfig == null) {\n            throw new RestException(Response.Status.BAD_REQUEST, \"Source config is not provided\");\n        }\n\n        throwRestExceptionIfUnauthorizedForNamespace(tenant, namespace, sourceName, \"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 != null && !namespaces.contains(qualifiedNamespaceWithCluster)) {\n                    log.error().attr(\"tenant\", tenant).attr(\"namespace\", namespace).attr(\"componentName\", sourceName)","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java#L78-L114","documentation":"Register-source request validation in SourcesImpl.registerSource: required fields of the registration request are missing (tenant checked first, source name among them) or the worker is unavailable, so the source registration REST call is rejected; the missing request field is the faulty input.","triggerScenarios":"POST /admin/v3/sources/{tenant}/{namespace}/{sourceName} with an empty name segment, or programmatic calls passing null sourceName after the tenant/namespace checks passed.","commonSituations":"URLs with a trailing slash and no component name; generated clients leaving the name argument null; bulk provisioning loops where the name variable was never assigned.","solutions":["Set the name field in the source config"],"exampleFix":"// before\nadmin.sources().createSource(tenant, namespace, null, fileName, config);\n// after\nString sourceName = cfg.getString(\"source.name\");\nValidate.notNull(sourceName, \"sourceName is required\");\nadmin.sources().createSource(tenant, namespace, sourceName, fileName, config);","handlingStrategy":"validation","validationCode":"if (sourceName == null || sourceName.isBlank()) throw new IllegalArgumentException(\"source name is required\");","typeGuard":"boolean isValidComponentName(String n) { return n != null && n.matches(\"[A-Za-z0-9_\\\\-.=]+\"); }","tryCatchPattern":"try { admin.sources().createSource(tenant, ns, name, file, cfg); } catch (PulsarAdminException e) { if (e.getStatusCode() == 400) { log.warn(\"invalid params: {}\", e.getMessage()); } throw e; }","preventionTips":["Require component names in deployment tooling (no silent defaults)","Validate names against Pulsar's allowed character set","Avoid trailing-slash URLs when building requests manually","Generate names deterministically in bulk provisioning loops"],"tags":["validation","http-400","rest-api","missing-argument"],"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-14T00:17:10.932Z"}