{"record":{"id":"8de7a675fd41949d","repo":"apache/beam","slug":"could-not-determine-the-filename-of-the-local-artifact","errorCode":null,"errorMessage":"Could not determine the filename of the local artifact {dependencyFilePath}","messagePattern":"Could not determine the filename of the local artifact (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/transform-service/launcher/src/main/java/org/apache/beam/sdk/transformservice/launcher/TransformServiceLauncher.java","lineNumber":165,"sourceCode":"      File file = updatedRequirementsFilePath.toFile();\n      if (!file.createNewFile()) {\n        throw new IOException(\n            \"Could not create the new requirements file \" + updatedRequirementsFilePath);\n      }\n\n      // Updating dependencies.\n      if (pythonRequirementsFile != null) {\n        Path requirementsFilePath = Paths.get(pythonRequirementsFile);\n        List<String> updatedLines = new ArrayList<>();\n\n        try (Stream<String> lines = java.nio.file.Files.lines(requirementsFilePath)) {\n          lines.forEachOrdered(\n              line -> {\n                Path dependencyFilePath = Paths.get(line);\n                if (java.nio.file.Files.exists(dependencyFilePath)) {\n                  Path fileName = dependencyFilePath.getFileName();\n                  if (fileName == null) {\n                    throw new IllegalArgumentException(\n                        \"Could not determine the filename of the local artifact \"\n                            + dependencyFilePath);\n                  }\n                  try {\n                    java.nio.file.Files.copy(\n                        dependencyFilePath,\n                        Paths.get(dependenciesDir.toString(), fileName.toString()));\n                  } catch (IOException e) {\n                    throw new RuntimeException(e);\n                  }\n                  updatedLines.add(fileName.toString());\n                } else {\n                  updatedLines.add(line);\n                }\n              });\n        }\n\n        try (BufferedWriter writer =","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/transform-service/launcher/src/main/java/org/apache/beam/sdk/transformservice/launcher/TransformServiceLauncher.java#L147-L183","documentation":"Thrown while copying each line of the Python requirements file into the dependencies volume: if a requirement line points to a local artifact (an existing path), Path.getFileName() returned null, meaning the path has no filename component (e.g. it is a root path). The launcher cannot determine what to name the copied artifact, so it aborts with this IllegalArgumentException.","triggerScenarios":"A line in the Python requirements file contains a local file path that exists but resolves to a path with a null filename — practically only when the path is a filesystem root (like \"/\" or \"C:\\\\\"), since getFileName() is non-null for normal file paths.","commonSituations":"A malformed requirements file line listing a directory root or an empty/odd path instead of an actual wheel or artifact file; hand-edited requirements files with trailing odd entries.","solutions":["Fix the requirements file so each local-artifact line points to an actual artifact file (e.g. a .whl or .tar.gz), not a directory or root path.","Validate requirement lines before launching: each must be a normal file with a non-null filename.","Remove blank or malformed lines from the requirements file."],"exampleFix":"// before (requirements.txt)\n/\n\n// after (requirements.txt)\n/artifacts/my_transform-1.0-py3-none-any.whl","handlingStrategy":"validation","validationCode":"for (String line : java.nio.file.Files.readAllLines(requirementsFile)) {\n  if (line.isBlank()) continue;\n  Path p = Paths.get(line);\n  if (java.nio.file.Files.exists(p)\n      && (p.getFileName() == null || !java.nio.file.Files.isRegularFile(p)))\n    throw new IllegalStateException(\"requirements entry must be a regular file: \" + line);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only list concrete artifact files (.whl/.tar.gz) in the requirements file, never directories or roots.","Lint the requirements file before launching.","Generate requirements entries programmatically rather than by hand."],"tags":["java","filesystem","path","requirements-file"],"backgroundTag":"invalid-argument-format","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}