{"record":{"id":"cca56d5c62398d32","repo":"apache/seatunnel","slug":"json-file-does-not-support-this-compress-type","errorCode":null,"errorMessage":"Json file does not support this compress type: {}","messagePattern":"Json file does not support this compress type: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/writer/JsonWriteStrategy.java","lineNumber":133,"sourceCode":"\n    @Override\n    public FSDataOutputStream getOrCreateOutputStream(@NonNull String filePath) {\n        FSDataOutputStream fsDataOutputStream = beingWrittenOutputStream.get(filePath);\n        if (fsDataOutputStream == null) {\n            try {\n                switch (compressFormat) {\n                    case LZO:\n                        LzopCodec lzo = new LzopCodec();\n                        OutputStream out =\n                                lzo.createOutputStream(\n                                        hadoopFileSystemProxy.getOutputStream(filePath));\n                        fsDataOutputStream = new FSDataOutputStream(out, null);\n                        break;\n                    case NONE:\n                        fsDataOutputStream = hadoopFileSystemProxy.getOutputStream(filePath);\n                        break;\n                    default:\n                        log.warn(\n                                \"Json file does not support this compress type: {}\",\n                                compressFormat.getCompressCodec());\n                        fsDataOutputStream = hadoopFileSystemProxy.getOutputStream(filePath);\n                        break;\n                }\n                beingWrittenOutputStream.put(filePath, fsDataOutputStream);\n                isFirstWrite.put(filePath, true);\n            } catch (IOException e) {\n                throw CommonError.fileOperationFailed(\"JsonFile\", \"open\", filePath, e);\n            }\n        }\n        return fsDataOutputStream;\n    }\n}\n","sourceCodeStart":115,"sourceCodeEnd":148,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/writer/JsonWriteStrategy.java#L115-L148","documentation":"Warning from JsonWriteStrategy.getOrCreateOutputStream when the compress format configured for a JSON text sink has no explicit handling branch. The strategy logs and writes uncompressed output instead, silently ignoring the requested compression.","triggerScenarios":"file_format=json sink with compress set to an unhandled codec (e.g. ZSTD, SNAPPY for text output); fires when the first record triggers stream creation in getOrCreateOutputStream.","commonSituations":"Copy-pasted configs from parquet/orc sinks; assumption that all Hadoop compression codecs work for text JSON; upstream enum additions not mirrored in JsonWriteStrategy.","solutions":["Use compress = \"gzip\" or \"none\" for json file format sinks","Check the docs for the compress formats supported by json output","Move to ORC/Parquet formats for richer codec support","Add a case for the codec in JsonWriteStrategy.getOrCreateOutputStream if needed"],"exampleFix":"// before\nsink = {\n  file_format = \"json\"\n  compress = \"snappy\"\n}\n// after\nsink = {\n  file_format = \"json\"\n  compress = \"gzip\"\n}","handlingStrategy":"validation","validationCode":"Set<String> supported = Set.of(\"none\", \"lzo\", \"gzip\");\nif (!supported.contains(compressValue.toLowerCase())) {\n    throw new IllegalArgumentException(\"json sink supports compress \" + supported + \", got: \" + compressValue);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use documented compress values for json format only","Run a small test job and inspect produced files before large runs","Keep sink configs per-format to avoid codec mismatches","Add switch-coverage tests for CompressFormat in write strategies"],"tags":["hadoop","file-sink","compression","json"],"backgroundTag":"unsupported-config-value","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"}