{"record":{"id":"41293c18ded37d65","repo":"apache/pulsar","slug":"the-specified-python-file-does-not-exist","errorCode":null,"errorMessage":"The specified python file does not exist","messagePattern":"The specified python file does not exist","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java","lineNumber":736,"sourceCode":"                    && 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.\");\n            }\n\n            if (!isBlank(functionConfig.getJar()) && !functionConfig.getJar().startsWith(\"builtin://\")\n                    && !Utils.isFunctionPackageUrlSupported(functionConfig.getJar())\n                    && !new File(functionConfig.getJar()).exists()) {\n                throw new ParameterException(\"The specified jar file does not exist\");\n            }\n            if (!isBlank(functionConfig.getPy()) && !Utils.isFunctionPackageUrlSupported(functionConfig.getPy())\n                    && !new File(functionConfig.getPy()).exists()) {\n                throw new ParameterException(\"The specified python file does not exist\");\n            }\n            if (!isBlank(functionConfig.getGo()) && !Utils.isFunctionPackageUrlSupported(functionConfig.getGo())\n                    && !new File(functionConfig.getGo()).exists()) {\n                throw new ParameterException(\"The specified go executable binary does not exist\");\n            }\n        }\n    }\n\n    @Command(description = \"Run a Pulsar Function locally, rather than deploy to a Pulsar cluster)\")\n    class LocalRunner extends FunctionDetailsCommand {\n\n        // TODO: this should become BookKeeper URL and it should be fetched from Pulsar client.\n        // for backwards compatibility purposes\n        @Option(names = \"--stateStorageServiceUrl\", description = \"The URL for the state storage service \"\n                + \"(the default is Apache BookKeeper)\", hidden = true)\n        protected String deprecatedStateStorageServiceUrl;\n        @Option(names = \"--state-storage-service-url\", description = \"The URL for the state storage service \"\n                + \"(the default is Apache BookKeeper) #Java, Python\")","sourceCodeStart":718,"sourceCodeEnd":754,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java#L718-L754","documentation":"Function package validation in CmdFunctions: the --py option names a Python file whose path does not exist on the local filesystem (the existence check on functionConfig.getPy() fails), so the function package cannot be uploaded; the py-file path is the faulty input.","triggerScenarios":"`pulsar-admin functions create/update/localrun` with --py <path> where the path is not a supported package URL and new File(path).exists() is false (CmdFunctions.java:736).","commonSituations":"Misspelled python file name; relative path used from the wrong working directory; .py file deleted or never uploaded to the machine running the CLI; case-sensitive filesystem mismatch (Func.py vs func.py) on Linux.","solutions":["Verify the --py file path and that it is readable","Use an absolute path if the relative one is resolved from a different working directory"],"exampleFix":"// before\n--py ./fucn.py\n// after\n--py /abs/path/func.py","handlingStrategy":"validation","validationCode":"String py = config.getPy();\nif (py != null && !Utils.isFunctionPackageUrlSupported(py) && !new File(py).exists()) {\n    throw new IllegalStateException(\"python file does not exist: \" + py);\n}","typeGuard":null,"tryCatchPattern":"try { admin.functions().createFunction(...); }\ncatch (ParameterException e) { if (e.getMessage().equals(\"The specified python file does not exist\")) { log.error(\"Check --py path: {}\", config.getPy()); } throw e; }","preventionTips":["Use absolute paths for --py in scripts","Check filename casing on Linux filesystems","Verify the .py file exists (test -f) before invoking the CLI"],"tags":["cli","filesystem","pulsar-functions"],"backgroundTag":"file-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"}