{"record":{"id":"9f28d4d72be55821","repo":"apache/beam","slug":"could-not-parse-the-provided-transform-service-config-file","errorCode":null,"errorMessage":"Could not parse the provided Transform Service config file + configFile","messagePattern":"Could not parse the provided Transform Service config file \\+ configFile","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/transform-service/src/main/java/org/apache/beam/sdk/transformservice/TransformServiceOptions.java","lineNumber":62,"sourceCode":"  TransformServiceConfig getTransformServiceConfig();\n\n  void setTransformServiceConfig(TransformServiceConfig configFile);\n\n  /** Loads the TransformService config. */\n  class TransformServiceConfigFactory implements DefaultValueFactory<TransformServiceConfig> {\n\n    @Override\n    public TransformServiceConfig create(PipelineOptions options) {\n      String configFile = options.as(TransformServiceOptions.class).getTransformServiceConfigFile();\n      if (configFile != null) {\n        File configFileObj = new File(configFile);\n        if (!configFileObj.exists()) {\n          throw new IllegalArgumentException(\"Config file \" + configFile + \" does not exist\");\n        }\n        try (InputStream stream = new FileInputStream(configFileObj)) {\n          return TransformServiceConfig.parseFromYamlStream(stream);\n        } catch (FileNotFoundException e) {\n          throw new RuntimeException(\n              \"Could not parse the provided Transform Service config file \" + configFile, e);\n        } catch (IOException e) {\n          throw new RuntimeException(\n              \"Could not parse the provided Transform Service config file \" + configFile, e);\n        }\n      }\n\n      return TransformServiceConfig.empty();\n    }\n  }\n}\n","sourceCodeStart":44,"sourceCodeEnd":74,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/transform-service/src/main/java/org/apache/beam/sdk/transformservice/TransformServiceOptions.java#L44-L74","documentation":"Thrown by TransformServiceOptions.create when TransformServiceConfig.parseFromYamlStream raises FileNotFoundException while reading the config file (FileNotFoundException is an IOException, caught first). Practically this happens on a TOCTOU race or permission/unreadable-path issue where File.exists() returned true but opening failed.","triggerScenarios":"The config file is deleted or renamed between the exists() check and new FileInputStream(); the path is a directory; permission denied surfaces as IOException on some platforms.","commonSituations":"File removed concurrently by another process/cleanup job; pointing at a directory rather than a file; restrictive permissions.","solutions":["Confirm the path is a regular file with read permissions (ls -l, not a directory).","Check nothing is concurrently deleting or renaming the file.","Re-run; if transient, add existence+readability validation before constructing pipeline options."],"exampleFix":"// before\nFile configFileObj = new File(configFile);\nif (!configFileObj.exists()) { ... }\n// after\nFile configFileObj = new File(configFile);\nif (!configFileObj.isFile() || !configFileObj.canRead()) {\n  throw new IllegalArgumentException(\"Config file not readable: \" + configFile);\n}","handlingStrategy":"validation","validationCode":"static void requireReadableFile(String path) {\n  File f = new File(path);\n  if (!f.isFile()) throw new IllegalArgumentException(\"Not a regular file: \" + path);\n  if (!f.canRead()) throw new IllegalArgumentException(\"No read permission: \" + path);\n}","typeGuard":null,"tryCatchPattern":"try {\n  config = TransformServiceConfig.from(options);\n} catch (RuntimeException e) {\n  if (e.getCause() instanceof FileNotFoundException) {\n    throw new IllegalStateException(\"Config file disappeared or is unreadable: \"\n        + options.as(TransformServiceOptions.class).getTransformServiceConfigFile(), e);\n  }\n  throw e;\n}","preventionTips":["Ensure no cleanup job deletes config files while the pipeline starts.","Point to a regular file, never a directory.","Set correct file permissions for the user running the pipeline."],"tags":["java","file-io","configuration"],"backgroundTag":"file-read-failed","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"}