{"record":{"id":"3ae81478dc6b76c1","repo":"apache/flink","slug":"localfilesystem-cannot-recover-recoverable-for-oth","errorCode":null,"errorMessage":"LocalFileSystem cannot recover recoverable for other file system: {}","messagePattern":"LocalFileSystem cannot recover recoverable for other file system: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/core/fs/local/LocalRecoverableWriter.java","lineNumber":65,"sourceCode":"    public RecoverableFsDataOutputStream open(Path filePath) throws IOException {\n        final File targetFile = fs.pathToFile(filePath);\n        final File tempFile = generateStagingTempFilePath(targetFile);\n\n        // try to create the parent\n        final File parent = tempFile.getParentFile();\n        if (parent != null && !parent.mkdirs() && !parent.exists()) {\n            throw new IOException(\"Failed to create the parent directory: \" + parent);\n        }\n\n        return new LocalRecoverableFsDataOutputStream(targetFile, tempFile);\n    }\n\n    @Override\n    public RecoverableFsDataOutputStream recover(ResumeRecoverable recoverable) throws IOException {\n        if (recoverable instanceof LocalRecoverable) {\n            return new LocalRecoverableFsDataOutputStream((LocalRecoverable) recoverable);\n        } else {\n            throw new IllegalArgumentException(\n                    \"LocalFileSystem cannot recover recoverable for other file system: \"\n                            + recoverable);\n        }\n    }\n\n    @Override\n    public boolean requiresCleanupOfRecoverableState() {\n        return false;\n    }\n\n    @Override\n    public boolean cleanupRecoverableState(ResumeRecoverable resumable) throws IOException {\n        return false;\n    }\n\n    @Override\n    public Committer recoverForCommit(CommitRecoverable recoverable) throws IOException {\n        if (recoverable instanceof LocalRecoverable) {","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/core/fs/local/LocalRecoverableWriter.java#L47-L83","documentation":"Thrown by LocalRecoverableWriter.recover when the supplied ResumeRecoverable is not an instance of LocalRecoverable. The LocalFileSystem writer can only resume streams it originally created; passing a recoverable from a different filesystem (e.g. HdfsRecoverable, S3Recoverable) is a type error caught at runtime.","triggerScenarios":"Calling LocalRecoverableWriter.recover(recoverable) where recoverable was produced by a non-local RecoverableFsDataOutputStream (HDFS, S3, etc.); mixing up writer instances across filesystem types in recovery logic.","commonSituations":"A job configured to use a remote filesystem (HDFS/S3) but recovery code mistakenly instantiates LocalRecoverableWriter; generic recovery code that does not dispatch on the filesystem type; testing with a local writer against data written by a distributed filesystem sink.","solutions":["Ensure the RecoverableFsDataOutputStream.Recoverable/ResumeRecoverable passed to recover was created by a LocalRecoverableFsDataOutputStream.","Dispatch recovery through the correct writer for the filesystem that originally wrote the data.","Add an instanceof check before calling recover to give a clearer error or skip."],"exampleFix":"// before\nRecoverableFsDataOutputStream out = localWriter.recover(recoverable);\n\n// after — dispatch by recoverable type\nRecoverableFsDataOutputStream out;\nif (recoverable instanceof LocalRecoverable) {\n    out = localWriter.recover(recoverable);\n} else {\n    out = matchingWriter.recover(recoverable);\n}","handlingStrategy":"type-guard","validationCode":"if (!(recoverable instanceof LocalRecoverable)) {\n    throw new IllegalArgumentException(\"Expected LocalRecoverable, got \" + recoverable.getClass());\n}","typeGuard":"recoverable instanceof LocalRecoverable","tryCatchPattern":null,"preventionTips":["Always dispatch recovery to the writer matching the filesystem that created the recoverable.","Add instanceof checks in generic recovery code before calling recover().","Avoid mixing writer types in a single recovery path."],"tags":["local-filesystem","type-mismatch","sink","recovery"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}