{"record":{"id":"914788e744069660","repo":"apache/flink","slug":"the-splitchange-type-of-s-is-not-supported","errorCode":null,"errorMessage":"The SplitChange type of %s is not supported.","messagePattern":"The SplitChange type of (.+?) is not supported\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/src/impl/FileSourceSplitReader.java","lineNumber":76,"sourceCode":"        this.config = config;\n        this.readerFactory = readerFactory;\n        this.splits = new ArrayDeque<>();\n    }\n\n    @Override\n    public RecordsWithSplitIds<RecordAndPosition<T>> fetch() throws IOException {\n        checkSplitOrStartNext();\n\n        final BulkFormat.RecordIterator<T> nextBatch = currentReader.readBatch();\n        return nextBatch == null\n                ? finishSplit()\n                : FileRecords.forRecords(currentSplitId, nextBatch);\n    }\n\n    @Override\n    public void handleSplitsChanges(final SplitsChange<SplitT> splitChange) {\n        if (!(splitChange instanceof SplitsAddition)) {\n            throw new UnsupportedOperationException(\n                    String.format(\n                            \"The SplitChange type of %s is not supported.\",\n                            splitChange.getClass()));\n        }\n\n        LOG.debug(\"Handling split change {}\", splitChange);\n        splits.addAll(splitChange.splits());\n    }\n\n    @Override\n    public void wakeUp() {}\n\n    @Override\n    public void close() throws Exception {\n        if (currentReader != null) {\n            currentReader.close();\n        }\n    }","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/src/impl/FileSourceSplitReader.java#L58-L94","documentation":"FileSourceSplitReader implements handleSplitsChanges to accept new file splits from the enumerator at runtime (SplitsAddition). It does not support any other SplitsChange subtype — most notably SplitsRemoval — because the file source does not support removing already-assigned splits during execution. Any non-SplitsAddition change triggers an UnsupportedOperationException.","triggerScenarios":"The framework sends a SplitsChange to the reader that is not an instance of SplitsAddition. This typically happens when a custom Source or framework logic attempts to remove splits from a FileSourceSplitReader. In standard Flink usage the enumerator only sends SplitsAddition events; this error surfaces when custom source integration or a framework path sends removal or other change types.","commonSituations":"Custom source wrapper that wraps a FileSourceSplitReader and forwards split changes including removals. Framework version change that introduces new SplitsChange subtypes. Integration with a system that attempts to revoke file splits (e.g. file deletion mid-job).","solutions":["Ensure only SplitsAddition events are forwarded to FileSourceSplitReader; filter out other SplitsChange types before calling handleSplitsChanges.","If split removal is required, use a custom SourceReader implementation that handles removal natively instead of delegating to FileSourceSplitReader.","Check the framework/Source integration code that dispatches SplitsChange objects and confirm it only produces SplitsAddition for file sources."],"exampleFix":"// before\nreader.handleSplitsChanges(splitChange);\n\n// after\nif (splitChange instanceof SplitsAddition) {\n    reader.handleSplitsChanges(splitChange);\n} else {\n    LOG.warn(\"Ignoring unsupported split change type: {}\", splitChange.getClass());\n}","handlingStrategy":"type-guard","validationCode":"// Filter split changes before forwarding to FileSourceSplitReader\nif (splitChange instanceof SplitsAddition) {\n    reader.handleSplitsChanges(splitChange);\n} else {\n    LOG.warn(\"FileSourceSplitReader only supports SplitsAddition; ignoring {}\", splitChange.getClass());\n}","typeGuard":"boolean isSplitsAddition(SplitsChange<?> change) {\n    return change instanceof SplitsAddition;\n}","tryCatchPattern":null,"preventionTips":["Never forward arbitrary SplitsChange types to FileSourceSplitReader — always guard with instanceof SplitsAddition.","If split removal is needed, implement a custom SourceReader that supports it natively.","Document in custom source wrappers which SplitsChange types are forwarded."],"tags":["split-change","file-source-reader","unsupported-operation","flink"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}