apache/seatunnel · error · ClickhouseConnectorException

clickhouse local file not exists

Error message

clickhouse local file not exists

What it means

generateClickhouseLocalFiles expects the clickhouse-local output directory `<localFileDir>/data/_local/<localTableName>` to exist after running clickhouse-local. When that path does not exist on disk it throws FILE_NOT_EXISTS with the message "clickhouse local file not exists".

Source

Thrown at seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/file/ClickhouseFileSinkWriter.java:354

                log.info(line);
            }
        }
        try (InputStream inputStream = start.getErrorStream();
                InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
                BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) {
            String line;
            while ((line = bufferedReader.readLine()) != null) {
                log.error(line);
            }
        }
        start.waitFor();
        File file =
                new File(
                        clickhouseLocalFile
                                + "/data/_local/"
                                + clickhouseTable.getLocalTableName());
        if (!file.exists()) {
            throw new ClickhouseConnectorException(
                    ClickhouseConnectorErrorCode.FILE_NOT_EXISTS,
                    "clickhouse local file not exists");
        }
        File[] files = file.listFiles();
        if (files == null) {
            throw new ClickhouseConnectorException(
                    ClickhouseConnectorErrorCode.FILE_NOT_EXISTS,
                    "clickhouse local file not exists");
        }
        return Arrays.stream(files)
                .filter(File::isDirectory)
                .filter(f -> !"detached".equals(f.getName()))
                .map(
                        f -> {
                            File newFile =
                                    new File(
                                            f.getParent()
                                                    + "/"

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify clickhouse-local completed successfully and check its output directory under localFileDir/data/_local/
  2. Confirm the local table name matches the directory created by clickhouse-local
  3. Ensure the localFileDir was not deleted between the clickhouse-local run and file collection (clearLocalFileDirectory runs on failure paths)
  4. Re-run the job and inspect any prior wrapped exception from the clickhouse-local invocation
Defensive patterns

Strategy: try-catch

Try / catch

try {
    // flush operation
} catch (ClickhouseConnectorException e) {
    if (e.getErrorCode().equals(ClickhouseConnectorErrorCode.FILE_NOT_EXISTS)) {
        // inspect localFileDir/data/_local/<table> existence and clickhouse-local logs
    }
}

Prevention

When it happens

Trigger: prepareCommit -> generateClickhouseLocalFiles when the clickhouse-local run did not create the expected `data/_local/<table>` directory — e.g. clickhouse-local failed silently, wrote to a different path, or the local dir was cleaned prematurely.

Common situations: clickhouse-local version writes output elsewhere than data/_local; the local table name differs from the expected localTableName; the temporary directory was deleted by a previous failed run's cleanup before retry.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/8802ddb44b32671f. Report an issue: GitHub.