{"record":{"id":"498b67348e0d263e","repo":"apache/pulsar","slug":"sink-archive-file-s-does-not-exist","errorCode":null,"errorMessage":"Sink Archive file %s does not exist","messagePattern":"Sink Archive file (.+?) does not exist","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSinks.java","lineNumber":641,"sourceCode":"        protected Map<String, Object> parseConfigs(String str) throws JsonProcessingException {\n            ObjectMapper mapper = ObjectMapperFactory.getMapper().getObjectMapper();\n            TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {};\n\n            return mapper.readValue(str, typeRef);\n        }\n\n        protected void validateSinkConfigs(SinkConfig sinkConfig) {\n\n            if (isBlank(sinkConfig.getArchive())) {\n                throw new ParameterException(\"Sink archive not specified\");\n            }\n\n            org.apache.pulsar.common.functions.Utils.inferMissingArguments(sinkConfig);\n\n            if (!Utils.isFunctionPackageUrlSupported(sinkConfig.getArchive())\n                    && !sinkConfig.getArchive().startsWith(Utils.BUILTIN)) {\n                if (!new File(sinkConfig.getArchive()).exists()) {\n                    throw new IllegalArgumentException(String.format(\"Sink Archive file %s does not exist\",\n                            sinkConfig.getArchive()));\n                }\n            }\n        }\n\n        protected String validateSinkType(String sinkType) throws IOException {\n            Set<String> availableSinks;\n            try {\n                availableSinks = getAdmin().sinks().getBuiltInSinks().stream()\n                        .map(ConnectorDefinition::getName).collect(Collectors.toSet());\n            } catch (PulsarAdminException e) {\n                throw new IOException(e);\n            }\n\n            if (!availableSinks.contains(sinkType)) {\n                throw new ParameterException(\n                        \"Invalid sink type '\" + sinkType + \"' -- Available sinks are: \" + availableSinks);\n            }","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSinks.java#L623-L659","documentation":"After inferMissingArguments, if the archive is neither a supported package URL (file://, http://, package://) nor a builtin:// reference, the CLI treats it as a local file path and requires the file to exist, throwing this IllegalArgumentException otherwise.","triggerScenarios":"Passing --archive with a relative/absolute local path that does not exist on the machine running the CLI (e.g. `--archive ./sink.nar` from the wrong directory, or the NAR was never built).","commonSituations":"Building the NAR in a different location than the CLI expects; running the command from another host/container where the file is absent; typo in the path.","solutions":["Verify the path with `ls <archive>` and fix the --archive value","Build the NAR first (mvn package) and point to the target/*.nar output","Use a package:// URL or http:// location if the archive is not local"],"exampleFix":"// before\n--archive ./sink.nar\n// after\n--archive /home/user/sink/target/sink-1.0.0.nar","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst archive = '/path/to/sink.nar';\nif (!archive.startsWith('builtin://') && !/^(file|http|package):/.test(archive) && !fs.existsSync(archive)) {\n  throw new Error(`Archive not found: ${archive}`);\n}","typeGuard":"const archiveExists = (p) => p.startsWith('builtin://') || /^(file|http|package):/.test(p) || fs.existsSync(p);","tryCatchPattern":"try {\n  // run sinks create\n} catch (e) {\n  if (e.message.includes('does not exist')) { /* fix archive path */ }\n  throw e;\n}","preventionTips":["Use absolute paths for local NAR archives","Run `ls` on the archive path before deploying","Build the NAR before deploying; prefer package:// URLs in shared environments"],"tags":["cli","pulsar-io","file-not-found"],"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-14T05:17:10.506Z"}