prestodb/presto · error · IllegalArgumentException

File doesn't exist %s

Error message

File doesn't exist %s

What it means

NativeExecutionSystemConfig.getAbsolutePath() resolves configured native execution paths (binaries, configs). Relative paths are resolved against SparkFiles.getRootDirectory() when SparkEnv is initialized, or the current directory otherwise. If the resolved file does not exist, it throws IllegalArgumentException 'File doesn't exist %s' during configuration validation.

Source

Thrown at presto-spark-base/src/main/java/com/facebook/presto/spark/execution/property/NativeExecutionSystemConfig.java:222

    }

    public NativeExecutionSystemConfig update(String key, String value)
    {
        systemConfigs.put(key, value);
        return this;
    }

    private String getAbsolutePath(String path)
    {
        File absolutePath = new File(path);
        if (!absolutePath.isAbsolute()) {
            // In the case of SparkEnv is not initialed (e.g. unit test), we just use current location instead of calling SparkFiles.getRootDirectory() to avoid error.
            String rootDirectory = SparkEnv$.MODULE$.get() != null ? SparkFiles.getRootDirectory() : ".";
            absolutePath = new File(rootDirectory, path);
        }

        if (!absolutePath.exists()) {
            throw new IllegalArgumentException(format("File doesn't exist %s", absolutePath.getAbsolutePath()));
        }

        return absolutePath.getAbsolutePath();
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify the absolute path from the error exists on the machine where this code runs
  2. Ship required files via spark.files/spark.archives so they land in SparkFiles.getRootDirectory()
  3. Use an absolute path in the configuration if you don't rely on Spark file distribution
  4. In tests, point the config at files relative to the test working directory since SparkEnv is null

Example fix

// before
native-execution-system.config=worker_config.json  # resolved against '.', missing
// after
spark.files=/opt/presto/etc/worker_config.json
native-execution-system.config=worker_config.json
Defensive patterns

Strategy: validation

Validate before calling

String root = SparkEnv$.MODULE$.get() != null ? SparkFiles.getRootDirectory() : ".";
File f = path.isAbsolute() ? new File(path) : new File(root, path);
if (!f.exists()) throw new IllegalStateException("Config file missing before init: " + f.getAbsolutePath());

Try / catch

try {
    nativeExecutionSystemConfig.getAbsolutePath(configuredPath);
} catch (IllegalArgumentException e) {
    // file missing at resolved location; fix config or distribute file
}

Prevention

When it happens

Trigger: getAbsolutePath (called from NativeExecutionSystemConfig getters during config binding/initialization) resolves a configured path and File.exists() is false — thrown at NativeExecutionSystemConfig.java:222 when the config is first accessed.

Common situations: Config points at a file that exists on the submitting machine but not on executors/drivers, relative path with no Spark files distributed (falls back to '.'), unit-test environments where SparkEnv is null and cwd lacks the file, or typos in config values.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/24cde8ea543361ae. Report an issue: GitHub.