{"record":{"id":"809870db7f4d402a","repo":"apache/flink","slug":"exception-in-writerecord","errorCode":null,"errorMessage":"Exception in writeRecord","messagePattern":"Exception in writeRecord","errorType":"exception","errorClass":"TableException","httpStatus":null,"severity":"error","filePath":"flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/table/FileSystemOutputFormat.java","lineNumber":206,"sourceCode":"                                    partitionColumns.length - staticPartitions.size() > 0,\n                                    dynamicGrouped,\n                                    staticPartitions)\n                            .create(\n                                    writerContext,\n                                    fileManager,\n                                    computer,\n                                    new PartitionWriter.DefaultPartitionWriterListener());\n        } catch (Exception e) {\n            throw new TableException(\"Exception in open\", e);\n        }\n    }\n\n    @Override\n    public void writeRecord(T record) {\n        try {\n            writer.write(record);\n        } catch (Exception e) {\n            throw new TableException(\"Exception in writeRecord\", e);\n        }\n    }\n\n    @Override\n    public void close() throws IOException {\n        try {\n            if (writer != null) {\n                writer.close();\n            }\n        } catch (Exception e) {\n            throw new TableException(\"Exception in close\", e);\n        }\n    }\n\n    /** Builder to build {@link FileSystemOutputFormat}. */\n    public static class Builder<T> {\n\n        private String[] partitionColumns;","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/table/FileSystemOutputFormat.java#L188-L224","documentation":"FileSystemOutputFormat.writeRecord delegates to the internal PartitionWriter.write. Any exception during record serialization, partition computation, or file I/O within the writer is caught and re-thrown as a TableException with message 'Exception in writeRecord'. This is the per-record write path, so failures here typically indicate data or serialization issues.","triggerScenarios":"The PartitionWriter.write call fails: record serialization fails (format-specific encoding error), the partition value computation throws (e.g. null partition key with no default handling), or a file system write error occurs on the current part file.","commonSituations":"Data type mismatch between the table schema and the incoming record. Serialization failure (e.g. invalid UTF-8 in CSV, schema evolution in Parquet). File system write failure (disk full, HDFS block size exceeded, S3 throttling). Null value in a partition column that triggers a NullPointerException in the partition computer.","solutions":["Examine the chained cause of the TableException to identify the serialization or I/O failure.","Validate input data types match the table schema; check for nulls in partition columns.","If the cause is file system I/O, check disk space, HDFS/S3 health, and write quotas.","If serialization-specific, ensure the format writer can handle the record type."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    outputFormat.writeRecord(record);\n} catch (TableException e) {\n    Throwable root = e.getCause();\n    // Log the failing record for debugging\n    LOG.error(\"Failed to write record: {}\", record, root);\n    throw e;\n}","preventionTips":["Validate input data types match the table schema before writing.","Handle null values in partition columns explicitly.","Monitor file system write latency and disk space.","Log failing records with their content for debugging serialization issues."],"tags":["output-format","write-record","serialization","table-exception","flink"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}