apache/beam · error · java.lang.IllegalArgumentException

Config file does not exist

Error message

Config file  does not exist

What it means

Thrown by the ExpansionServiceConfig provider's create() when the expansion service config file option is set but the file does not exist on disk. Like the allowlist check, this validates existence eagerly with a descriptive IllegalArgumentException.

Solutions

  1. Verify the path with 'ls -l <path>' and correct it (prefer absolute paths).
  2. Create the config YAML with at least an allowlist key if it does not exist yet.
  3. If no config file is needed, unset the option so the service uses the default empty config.

Example fix

// before
--expansionServiceConfigFile=config.yaml   # relative, wrong cwd
// after
--expansionServiceConfigFile=/etc/expansion-service/config.yaml
Defensive patterns

Strategy: validation

Validate before calling

String cfgPath = options.as(ExpansionServiceOptions.class).getExpansionServiceConfigFile();
if (cfgPath != null && !new File(cfgPath).exists()) {
  throw new IllegalStateException("Expansion service config file does not exist: " + cfgPath);
}

Try / catch

try {
  startExpansionService(options);
} catch (IllegalArgumentException e) {
  if (e.getMessage().contains("Config file") && e.getMessage().contains("does not exist")) { /* fix path or create config */ }
  throw e;
}

Prevention

When it happens

Trigger: Starting the service with --expansionServiceConfigFile (or equivalent) pointing to a missing file or a mistyped path.

Common situations: Typo in the flag value; running from a different working directory so relative paths break; config file forgotten when replicating a deployment; Kubernetes volume mount missing so path is absent.

Understand the failure class

Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/92d83082631156fb. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/ExpansionServiceOptions.java:119

              "Could not parse the provided allowlist file " + allowListFile, e);
        }
      }

      // By default produces an empty allow-list.
      return AllowList.nothing();
    }
  }

  /** Loads the ExpansionService config. */
  class ExpansionServiceConfigFactory implements DefaultValueFactory<ExpansionServiceConfig> {

    @Override
    public ExpansionServiceConfig create(PipelineOptions options) {
      String configFile = options.as(ExpansionServiceOptions.class).getExpansionServiceConfigFile();
      if (configFile != null) {
        File configFileObj = new File(configFile);
        if (!configFileObj.exists()) {
          throw new IllegalArgumentException("Config file " + configFile + " does not exist");
        }
        try (InputStream stream = new FileInputStream(configFileObj)) {
          return ExpansionServiceConfig.parseFromYamlStream(stream);
        } catch (FileNotFoundException e) {
          throw new RuntimeException(
              "Could not parse the provided Expansion Service config file" + configFile, e);
        } catch (IOException e) {
          throw new RuntimeException(
              "Could not parse the provided Expansion Service config file" + configFile, e);
        }
      }

      // By default produces null.
      return ExpansionServiceConfig.empty();
    }
  }
}

View on GitHub (pinned to 12126d8942)