{"record":{"id":"649fc36c2d113d28","repo":"apache/flink","slug":"exception-in-open","errorCode":null,"errorMessage":"Exception in open","messagePattern":"Exception in open","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":197,"sourceCode":"                            fsFactory,\n                            stagingPath,\n                            context.getTaskNumber(),\n                            context.getAttemptNumber(),\n                            outputFileConfig);\n            PartitionWriter.Context<T> writerContext =\n                    new PartitionWriter.Context<>(parameters, formatFactory);\n            writer =\n                    PartitionWriterFactory.<T>get(\n                                    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            }","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/table/FileSystemOutputFormat.java#L179-L215","documentation":"FileSystemOutputFormat.open initializes the PartitionWriter by selecting the appropriate writer factory based on partition columns and grouping settings, then creates the writer. Any exception during this initialization — format factory instantiation, file system access for output files, or writer creation — is caught and wrapped in a TableException with message 'Exception in open'.","triggerScenarios":"The PartitionWriterFactory.create call fails: output directory cannot be created, the format factory throws during initialization, the partition computer setup fails, or a file system permission issue prevents opening output files for writing.","commonSituations":"Output directory permissions are insufficient. Format factory (e.g. Parquet, CSV, JSON) fails to initialize due to schema mismatch or missing dependencies. File system path is unreachable (HDFS/S3 connectivity). Disk full on the TaskManager node.","solutions":["Examine the chained cause of the TableException to find the underlying failure.","Verify the output path exists or is creatable and is writable by the Flink TaskManager process.","Ensure the correct format JAR is on the classpath and the format factory initializes without error.","Check for disk space and file system quotas on the TaskManager node."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    outputFormat.open(...);\n} catch (TableException e) {\n    Throwable root = e.getCause();\n    // Inspect root cause: permission, format init, FS connectivity\n    throw new RuntimeException(\"Failed to open output format\", root);\n}","preventionTips":["Verify output directory permissions before job submission.","Ensure the format JAR and its dependencies are on the classpath.","Test format initialization with a small sample before production runs.","Check disk space on TaskManager nodes."],"tags":["output-format","open","partition-writer","table-exception","flink"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}