{"record":{"id":"37e4c3d59efa6df0","repo":"apache/pulsar","slug":"no-function-name-specified","errorCode":null,"errorMessage":"No Function name specified","messagePattern":"No Function name specified","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java","lineNumber":708,"sourceCode":"            }\n\n            // check if configs are valid\n            validateFunctionConfigs(functionConfig);\n        }\n\n        protected void validateFunctionConfigs(FunctionConfig functionConfig) {\n            // go doesn't need className\n            if (functionConfig.getPy() != null\n                    || (functionConfig.getJar() != null && !functionConfig.getJar().startsWith(\"builtin://\"))) {\n                if (StringUtils.isEmpty(functionConfig.getClassName())) {\n                    throw new ParameterException(\"No Function Classname specified\");\n                }\n            }\n            if (StringUtils.isEmpty(functionConfig.getName())) {\n                org.apache.pulsar.common.functions.Utils.inferMissingFunctionName(functionConfig);\n            }\n            if (StringUtils.isEmpty(functionConfig.getName())) {\n                throw new IllegalArgumentException(\"No Function name specified\");\n            }\n            if (StringUtils.isEmpty(functionConfig.getTenant())) {\n                org.apache.pulsar.common.functions.Utils.inferMissingTenant(functionConfig);\n            }\n            if (StringUtils.isEmpty(functionConfig.getNamespace())) {\n                org.apache.pulsar.common.functions.Utils.inferMissingNamespace(functionConfig);\n            }\n\n            if (isNotBlank(functionConfig.getJar()) && isNotBlank(functionConfig.getPy())\n                    && isNotBlank(functionConfig.getGo())) {\n                throw new ParameterException(\"Either a Java jar or a Python file or a Go executable binary needs to\"\n                        + \" be specified for the function. Cannot specify both.\");\n            }\n\n            if (isBlank(functionConfig.getJar()) && isBlank(functionConfig.getPy())\n                    && isBlank(functionConfig.getGo())) {\n                throw new ParameterException(\"Either a Java jar or a Python file or a Go executable binary needs to\"\n                        + \" be specified for the function. Please specify one.\");","sourceCodeStart":690,"sourceCodeEnd":726,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java#L690-L726","documentation":"validateFunctionConfigs tries Utils.inferMissingFunctionName to derive the function name (typically from the jar filename) and, if the name is still empty, throws IllegalArgumentException 'No Function name specified'. Every function must have a resolvable name in its FunctionConfig.","triggerScenarios":"Functions create/update where neither --name nor an inferable source (e.g. a jar file path whose filename can serve as the name) is provided, leaving FunctionConfig.name empty after inference.","commonSituations":"Using --function-type or builtin:// jars with no --name (nothing to infer from), scripts building configs programmatically without setting the name, or typos in the --name flag.","solutions":["Pass --name explicitly with the function name.","Or use --fqfn tenant/namespace/name, which sets the name from its third segment.","If relying on inference, pass a --jar with a usable file name so inferMissingFunctionName can derive the name."],"exampleFix":"// before\npulsar-admin functions create --tenant public --namespace default --classname org.ex.MyFn --function-type Exclamation\n// after\npulsar-admin functions create --tenant public --namespace default --name ex --classname org.ex.MyFn --function-type Exclamation","handlingStrategy":"validation","validationCode":"if (StringUtils.isEmpty(name) && (fqfn == null || fqfn.split(\"/\").length != 3) && jarFile == null) {\n    throw new IllegalArgumentException(\"Function name required: pass --name, --fqfn, or a jar to infer from\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    functionsCmd.run();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Function name\")) {\n        System.err.println(\"Add --name (or --fqfn tenant/namespace/name).\");\n    }\n}","preventionTips":["Always pass --name explicitly; do not rely on filename inference in automated pipelines.","Remember --function-type/builtin:// deployments give inference nothing to derive a name from.","Set name/tenant/namespace in the function config file when using --function-config."],"tags":["cli","functions","missing-argument","pulsar-functions"],"backgroundTag":"missing-required-argument","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"}