{"record":{"id":"f9fa0f92bf8fff62","repo":"apache/seatunnel","slug":"received-altertableevent-but-schema-evolution-enab","errorCode":null,"errorMessage":"Received AlterTableEvent but schema_evolution_enabled=false at this sink. Either set schema_evolution_enabled=true to handle schema changes, or set schema-changes.enabled=false at the CDC source to suppress them.","messagePattern":"Received AlterTableEvent but schema_evolution_enabled=false at this sink\\. Either set schema_evolution_enabled=true to handle schema changes, or set schema-changes\\.enabled=false at the CDC source to suppress them\\.","errorType":"validation","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/writer/AbstractWriteStrategy.java","lineNumber":230,"sourceCode":"    }\n\n    /**\n     * set seaTunnelRowTypeInfo in writer\n     *\n     * @param catalogTable seaTunnelRowType\n     */\n    @Override\n    public void setCatalogTable(CatalogTable catalogTable) {\n        this.tableSchema = catalogTable.getTableSchema();\n        this.seaTunnelRowType = catalogTable.getSeaTunnelRowType();\n    }\n\n    // ── Schema Evolution ──────────────────────────────────────────────────────────\n\n    @Override\n    public void applySchemaChange(SchemaChangeEvent event) throws IOException {\n        if (!fileSinkConfig.isSchemaEvolutionEnabled()) {\n            throw new UnsupportedOperationException(\n                    \"Received AlterTableEvent but schema_evolution_enabled=false at this sink. \"\n                            + \"Either set schema_evolution_enabled=true to handle schema changes, \"\n                            + \"or set schema-changes.enabled=false at the CDC source to suppress them.\");\n        }\n        log.info(\n                \"[FileSchemaEvolution] applying {} — before: rowType={}, sinkColumns={}, indices={}\",\n                event.getClass().getSimpleName(),\n                seaTunnelRowType,\n                sinkColumnNames,\n                sinkColumnsIndexInRow);\n\n        // Step 1: flush + close all open writers; register partial files for commit.\n        // Reuses the subclass finishAndCloseFile() — Parquet and ORC each close their own\n        // beingWrittenWriter map entries and add to needMoveFiles there.\n        // beingWrittenFile.clear() is in a finally block to guarantee it runs even if a writer\n        // fails to close, so stale path entries never accumulate in the cache.\n        try {\n            finishAndCloseFile();","sourceCodeStart":212,"sourceCodeEnd":248,"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/AbstractWriteStrategy.java#L212-L248","documentation":"The file sink received an AlterTableEvent (schema change from an upstream CDC source) but schema evolution is not enabled in its config. The sink refuses to apply schema changes it was not configured to handle, throwing UnsupportedOperationException. This is a deliberate configuration-mismatch guard: either the sink must opt in to schema evolution, or the CDC source must stop emitting change events.","triggerScenarios":"Calling applySchemaChange(SchemaChangeEvent) on AbstractWriteStrategy while FileSinkConfig.isSchemaEvolutionEnabled() is false, which happens when a CDC source with schema-changes.enabled=true feeds a file sink without schema_evolution_enabled=true.","commonSituations":"Pipelines where a MySQL/PostgreSQL CDC source picks up a new column mid-run and emits AlterTableEvents; developer upgraded the CDC connector to emit schema-change events but never enabled schema evolution on the file sink.","solutions":["Set schema_evolution_enabled = true in the file sink config so it can apply ALTER events","Or set schema-changes.enabled = false on the CDC source to suppress AlterTableEvents entirely","If the pipeline truly has a fixed schema, revert the upstream ALTER so no events are emitted"],"exampleFix":"// before\nsink {\n  LocalFile {\n    path = \"/data/output\"\n    file_format_type = \"parquet\"\n  }\n}\n// after\nsink {\n  LocalFile {\n    path = \"/data/output\"\n    file_format_type = \"parquet\"\n    schema_evolution_enabled = true\n  }\n}","handlingStrategy":"validation","validationCode":"// before submitting the job\nif (cdcSourceUsesSchemaChanges() && !fileSinkConfig.schemaEvolutionEnabled) {\n  throw new IllegalArgumentException(\"Enable schema_evolution_enabled=true on the file sink or set schema-changes.enabled=false on the CDC source\");\n}","typeGuard":null,"tryCatchPattern":"try { sink.applySchemaChange(event); } catch (UnsupportedOperationException e) { log.error(\"Schema evolution disabled at file sink: {}\", e.getMessage()); /* fix config and resubmit */ }","preventionTips":["When pairing CDC sources with file sinks, always decide explicitly: schema_evolution_enabled=true at sink or schema-changes.enabled=false at source","Validate the combined pipeline config at submit time instead of at runtime","Review CDC source configs when upgrading connectors that start emitting schema-change events"],"tags":["file-sink","schema-evolution","cdc","config"],"backgroundTag":"conflicting-config-options","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}