{"record":{"id":"f2d1153c290773d2","repo":"apache/pulsar","slug":"does-not-exists-locally","errorCode":null,"errorMessage":" does not exists locally","messagePattern":" does not exists locally","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionCommon.java","lineNumber":259,"sourceCode":"        try (InputStream in = connection.getInputStream()) {\n            log.info().attr(\"url\", destPkgUrl).attr(\"target\", targetFile.getAbsoluteFile())\n                    .log(\"Downloading function package\");\n            Files.copy(in, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);\n        }\n        log.info().attr(\"url\", destPkgUrl).attr(\"target\", targetFile.getAbsoluteFile())\n                .log(\"Downloading function package completed\");\n    }\n\n    public static File createPkgTempFile() throws IOException {\n        return File.createTempFile(\"functions\", \".tmp\");\n    }\n\n    public static File extractFileFromPkgURL(String destPkgUrl) throws IOException, URISyntaxException {\n        if (destPkgUrl.startsWith(Utils.FILE)) {\n            URL url = new URL(destPkgUrl);\n            File file = new File(url.toURI());\n            if (!file.exists()) {\n                throw new IOException(destPkgUrl + \" does not exists locally\");\n            }\n            return file;\n        } else if (destPkgUrl.startsWith(\"http\")) {\n            File tempFile = createPkgTempFile();\n            tempFile.deleteOnExit();\n            downloadFromHttpUrl(destPkgUrl, tempFile);\n            return tempFile;\n        } else {\n            throw new IllegalArgumentException(\"Unsupported url protocol \"\n                    + destPkgUrl + \", supported url protocols: [file/http/https]\");\n        }\n    }\n\n    public static String getFullyQualifiedInstanceId(Instance instance) {\n        return getFullyQualifiedInstanceId(\n                instance.getFunctionMetaData().getFunctionDetails().getTenant(),\n                instance.getFunctionMetaData().getFunctionDetails().getNamespace(),\n                instance.getFunctionMetaData().getFunctionDetails().getName(),","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionCommon.java#L241-L277","documentation":"FunctionCommon.extractFileFromPkgURL resolves a function/sink/source package URL to a local File. When the URL uses the file:// protocol but the referenced file cannot be found on the local filesystem, it throws this IOException (message: '<url> does not exists locally').","triggerScenarios":"Submitting/updating a function with a package URL like file:///path/to/app.jar where the path does not exist on the machine performing the resolution (function worker host), e.g. after the artifact was moved/deleted, a wrong absolute path, or submitting from a machine where the file exists but the worker's host where it does not.","commonSituations":"Cluster deployments where workers run on different nodes than the submitter; artifacts cleaned from /tmp or a shared mount that is not mounted; Docker containers lacking the volume containing the jar; typos in the file:// path.","solutions":["Verify the file exists at the exact path on the host resolving the URL and correct the path","Copy the artifact to a location shared/visible to all function workers (e.g. a distributed filesystem mount or the same path on every node)","Switch to an http(s):// package URL served from a reachable location, or upload the package to Pulsar's package management service","Re-upload the artifact if it was deleted or a build cleanup removed it"],"exampleFix":"// before\nnew CreateFunction().setPkgUrl(\"file:///build/old/app.jar\") // deleted by clean\n// after\nnew CreateFunction().setPkgUrl(\"file:///opt/functions/app.jar\"); // artifact placed on worker-visible path\n// or: setPkgUrl(\"https://artifacts.internal/functions/app.jar\")","handlingStrategy":"validation","validationCode":"// Pre-check the file:// package URL\nString pkgUrl = \"file:///opt/functions/app.jar\";\nif (pkgUrl.startsWith(\"file://\")) {\n  java.io.File f = new java.io.File(java.net.URI.create(pkgUrl));\n  if (!f.exists() || !f.canRead()) {\n    throw new IllegalStateException(\"Package not accessible on this host: \" + pkgUrl);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  File f = FunctionCommon.extractFileFromPkgURL(pkgUrl);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().endsWith(\"does not exists locally\")) {\n    log.error(\"Package file missing on worker host: {}\", pkgUrl);\n    // re-upload artifact or switch to an http(s) URL and retry\n  } else {\n    throw e;\n  }\n}","preventionTips":["Use paths visible to all function workers (shared/NFS mount) for file:// URLs","Prefer uploading packages via the Pulsar package management service or http(s) URLs","Verify the artifact exists on the worker host, not just the submitter host","Avoid placing artifacts in temp dirs subject to cleanup"],"tags":["pulsar-functions","filesystem","package-url","io"],"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"}