{"record":{"id":"2587d93868461fb3","repo":"apache/flink","slug":"can-not-recover-from-the-pendingfilerecoverable","errorCode":null,"errorMessage":"can not recover from the pendingFileRecoverable","messagePattern":"can not recover from the pendingFileRecoverable","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-connectors/flink-file-sink-common/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/OutputStreamBasedPartFileWriter.java","lineNumber":168,"sourceCode":"                    creationTime);\n        }\n\n        @Override\n        public PendingFile recoverPendingFile(final PendingFileRecoverable pendingFileRecoverable)\n                throws IOException {\n            final RecoverableWriter.CommitRecoverable commitRecoverable;\n\n            if (pendingFileRecoverable instanceof OutputStreamBasedPendingFileRecoverable) {\n                commitRecoverable =\n                        ((OutputStreamBasedPendingFileRecoverable) pendingFileRecoverable)\n                                .getCommitRecoverable();\n            } else if (pendingFileRecoverable\n                    instanceof OutputStreamBasedInProgressFileRecoverable) {\n                commitRecoverable =\n                        ((OutputStreamBasedInProgressFileRecoverable) pendingFileRecoverable)\n                                .getResumeRecoverable();\n            } else {\n                throw new IllegalArgumentException(\n                        \"can not recover from the pendingFileRecoverable\");\n            }\n            return new OutputStreamBasedPendingFile(\n                    recoverableWriter.recoverForCommit(commitRecoverable));\n        }\n\n        @Override\n        public boolean cleanupInProgressFileRecoverable(\n                InProgressFileRecoverable inProgressFileRecoverable) throws IOException {\n            final RecoverableWriter.ResumeRecoverable resumeRecoverable =\n                    ((OutputStreamBasedInProgressFileRecoverable) inProgressFileRecoverable)\n                            .getResumeRecoverable();\n            return recoverableWriter.cleanupRecoverableState(resumeRecoverable);\n        }\n\n        @Override\n        public WriterProperties getProperties() {\n            return new WriterProperties(","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-connectors/flink-file-sink-common/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/OutputStreamBasedPartFileWriter.java#L150-L186","documentation":"Thrown by OutputStreamBasedBucketWriter.recoverForCommit when the provided PendingFileRecoverable is neither OutputStreamBasedPendingFileRecoverable nor OutputStreamBasedInProgressFileRecoverable. The recovery path only understands these two concrete types; any other PendingFileRecoverable implementation cannot be deserialized into a commit-recoverable handle.","triggerScenarios":"Calling BucketWriter.recoverForCommit() with a PendingFileRecoverable produced by a different BucketWriter implementation or a corrupt/incompatible serialized state.","commonSituations":"Restoring a savepoint taken with a different RecoverableWriter (e.g. switching filesystem types from HDFS to S3 without re-taking the savepoint); a custom RecoverableWriter whose recoverable types are incompatible with OutputStreamBasedPartFileWriter.","solutions":["Ensure the RecoverableWriter and BucketWriter used at recovery time match those used when the state was originally checkpointed.","Re-take the savepoint after changing the underlying filesystem or recoverable writer implementation.","Do not mix custom PendingFileRecoverable implementations with the built-in OutputStreamBased recoverables."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"public static boolean isRecoverableSupported(PendingFileRecoverable r) {\n    return r instanceof OutputStreamBasedPendingFileRecoverable\n        || r instanceof OutputStreamBasedInProgressFileRecoverable;\n}","tryCatchPattern":"if (!isRecoverableSupported(pendingFileRecoverable)) {\n    throw new IllegalStateException(\n        \"Unsupported PendingFileRecoverable type: \" + pendingFileRecoverable.getClass());\n}\nbucketWriter.recoverForCommit(pendingFileRecoverable);","preventionTips":["Use the same RecoverableWriter implementation for both writing and restoring state.","Do not switch filesystem types (HDFS to S3) without re-taking the savepoint.","Type-check PendingFileRecoverable instances before passing to recoverForCommit."],"tags":["file-sink","recovery","state-compatibility","internal-api"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}