{"record":{"id":"8802ddb44b32671f","repo":"apache/seatunnel","slug":"clickhouse-local-file-not-exists","errorCode":null,"errorMessage":"clickhouse local file not exists","messagePattern":"clickhouse local file not exists","errorType":"exception","errorClass":"ClickhouseConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/file/ClickhouseFileSinkWriter.java","lineNumber":354,"sourceCode":"                log.info(line);\n            }\n        }\n        try (InputStream inputStream = start.getErrorStream();\n                InputStreamReader inputStreamReader = new InputStreamReader(inputStream);\n                BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) {\n            String line;\n            while ((line = bufferedReader.readLine()) != null) {\n                log.error(line);\n            }\n        }\n        start.waitFor();\n        File file =\n                new File(\n                        clickhouseLocalFile\n                                + \"/data/_local/\"\n                                + clickhouseTable.getLocalTableName());\n        if (!file.exists()) {\n            throw new ClickhouseConnectorException(\n                    ClickhouseConnectorErrorCode.FILE_NOT_EXISTS,\n                    \"clickhouse local file not exists\");\n        }\n        File[] files = file.listFiles();\n        if (files == null) {\n            throw new ClickhouseConnectorException(\n                    ClickhouseConnectorErrorCode.FILE_NOT_EXISTS,\n                    \"clickhouse local file not exists\");\n        }\n        return Arrays.stream(files)\n                .filter(File::isDirectory)\n                .filter(f -> !\"detached\".equals(f.getName()))\n                .map(\n                        f -> {\n                            File newFile =\n                                    new File(\n                                            f.getParent()\n                                                    + \"/\"","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/file/ClickhouseFileSinkWriter.java#L336-L372","documentation":"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\".","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify clickhouse-local completed successfully and check its output directory under localFileDir/data/_local/","Confirm the local table name matches the directory created by clickhouse-local","Ensure the localFileDir was not deleted between the clickhouse-local run and file collection (clearLocalFileDirectory runs on failure paths)","Re-run the job and inspect any prior wrapped exception from the clickhouse-local invocation"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    // flush operation\n} catch (ClickhouseConnectorException e) {\n    if (e.getErrorCode().equals(ClickhouseConnectorErrorCode.FILE_NOT_EXISTS)) {\n        // inspect localFileDir/data/_local/<table> existence and clickhouse-local logs\n    }\n}","preventionTips":["Confirm clickhouse-local output layout matches data/_local/<localTableName> for your ClickHouse version","Do not clean the temp directory between generation and flush","Log clickhouse-local stdout/stderr to catch silent failures"],"tags":["clickhouse","file-not-found","flush"],"backgroundTag":"file-not-found","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}