{"record":{"id":"00b6722d47d4bb14","repo":"apache/beam","slug":"could-not-parse-the-provided-allowlist-file","errorCode":null,"errorMessage":"Could not parse the provided allowlist file ","messagePattern":"Could not parse the provided allowlist file ","errorType":"exception","errorClass":"java.lang.RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/ExpansionServiceOptions.java","lineNumber":97,"sourceCode":"  class JavaClassLookupAllowListFactory implements DefaultValueFactory<AllowList> {\n\n    @Override\n    public AllowList create(PipelineOptions options) {\n      String allowListFile =\n          options.as(ExpansionServiceOptions.class).getJavaClassLookupAllowlistFile();\n      if (allowListFile != null) {\n        if (allowListFile.equals(\"*\")) {\n          return AllowList.everything();\n        }\n        File allowListFileObj = new File(allowListFile);\n        if (!allowListFileObj.exists()) {\n          throw new IllegalArgumentException(\n              \"Allow list file \" + allowListFile + \" does not exist\");\n        }\n        try (InputStream stream = new FileInputStream(allowListFileObj)) {\n          return AllowList.parseFromYamlStream(stream);\n        } catch (FileNotFoundException e) {\n          throw new RuntimeException(\n              \"Could not parse the provided allowlist file \" + allowListFile, e);\n        } catch (IOException e) {\n          throw new RuntimeException(\n              \"Could not parse the provided allowlist file \" + allowListFile, e);\n        }\n      }\n\n      // By default produces an empty allow-list.\n      return AllowList.nothing();\n    }\n  }\n\n  /** Loads the ExpansionService config. */\n  class ExpansionServiceConfigFactory implements DefaultValueFactory<ExpansionServiceConfig> {\n\n    @Override\n    public ExpansionServiceConfig create(PipelineOptions options) {\n      String configFile = options.as(ExpansionServiceOptions.class).getExpansionServiceConfigFile();","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/ExpansionServiceOptions.java#L79-L115","documentation":"Wraps a FileNotFoundException thrown while opening the allowlist file for parsing in AllowList.create. Although existence was just checked, the open can still fail; the service rethrows as a RuntimeException labeled 'Could not parse the provided allowlist file' with the path and cause attached.","triggerScenarios":"A race where the allowlist file is deleted between the exists() check and new FileInputStream(); a broken symlink or permission-denied scenario surfaced as FileNotFoundException on open.","commonSituations":"File removed by a cleanup job or container restart mid-startup; symlink pointing to a target that no longer exists; TOCTOU between validation and open in scripts that manage config files.","solutions":["Re-check that the file exists and is readable right before starting the service, then retry startup.","Resolve or remove broken symlinks in the path.","Fix filesystem permissions so the service user can read the file.","Inspect the wrapped cause (e) for the precise errno (e.g. No such file, Permission denied)."],"exampleFix":"// before\njava -jar expansion-service.jar --allowListFile=/stale/symlink.yml\n// after\nls -lL /stale/symlink.yml   # verify target exists, then point to the real file\njava -jar expansion-service.jar --allowListFile=/real/allowlist.yml","handlingStrategy":"try-catch","validationCode":"File f = new File(allowListPath);\nif (!f.isFile() || !f.canRead()) {\n  throw new IllegalStateException(\"Allowlist not readable (check symlink/permissions): \" + allowListPath);\n}","typeGuard":null,"tryCatchPattern":"try {\n  startExpansionService(options);\n} catch (RuntimeException e) {\n  if (e.getCause() instanceof FileNotFoundException) { /* file vanished or broken symlink; re-verify and retry */ }\n  throw e;\n}","preventionTips":["Avoid symlinks for config files in deployments; mount real files.","Ensure the file is not deleted by cleanup jobs while the service starts.","Check read permissions for the service's OS user."],"tags":["java","file","io","allowlist"],"backgroundTag":"file-open-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"}