apache/flink · error · FileNotFoundException

File {} does not exist or the user running Flink ('{}') has

Error message

File {} does not exist or the user running Flink ('{}') has insufficient permissions to access it.

What it means

Thrown as FileNotFoundException by LocalFileSystem.getFileStatus() when the underlying java.io.File does not exist. The message also covers the case where the file is present but the running user lacks read/permission access, since java.io.File.exists() returns false in both cases.

Source

Thrown at flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java:100

    // ------------------------------------------------------------------------

    @Override
    public BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len)
            throws IOException {
        if (file instanceof LocalFileStatus) {
            return ((LocalFileStatus) file).getBlockLocations();
        }
        throw new IOException("File status does not belong to the LocalFileSystem: " + file);
    }

    @Override
    public FileStatus getFileStatus(Path f) throws IOException {
        final File path = pathToFile(f);
        if (path.exists()) {
            return new LocalFileStatus(path, this);
        } else {
            throw new FileNotFoundException(
                    "File "
                            + f
                            + " does not exist or the user running "
                            + "Flink ('"
                            + System.getProperty("user.name")
                            + "') has insufficient permissions to access it.");
        }
    }

    @Override
    public URI getUri() {
        return LOCAL_URI;
    }

    @Override
    public Path getWorkingDirectory() {
        return new Path(workingDir);
    }

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Verify the path exists on the local disk and is readable by the Flink process user: `ls -l <path>`.
  2. Check the user running the TaskManager/JobManager has read permissions, or chown/chmod the file.
  3. Use an absolute path; confirm working directory expectations.
  4. If the file genuinely is gone, restore from checkpoint/savepoint or regenerate.
Defensive patterns

Strategy: validation

Validate before calling

void ensureReadable(LocalFileSystem fs, Path p) throws IOException {
    File f = new File(p.toUri());
    if (!f.exists() || !f.canRead())
        throw new FileNotFoundException("Not accessible: " + p);
    fs.getFileStatus(p);
}

Try / catch

try {
    fs.getFileStatus(p);
} catch (FileNotFoundException e) {
    // log and surface config/user hint, or fallback path
    throw e;
}

Prevention

When it happens

Trigger: Calling getFileStatus(path) where pathToFile(path) points to a non-existent local file, or to a file the current OS user cannot access/stat.

Common situations: Wrong checkpoint/savepoint path; path relative to wrong working directory; Flink running as a user without read permission on the target file; path with a typo or wrong scheme resolution.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/704de7fb29e0ec74. Report an issue: GitHub.