{"record":{"id":"983f85bb9b006836","repo":"apache/flink","slug":"error-recovering-writer-downloading-the-last-data-983f85","errorCode":null,"errorMessage":"Error recovering writer: Downloading the last data chunk file gives incorrect length.File length is %d bytes, RecoveryData indicates %d bytes","messagePattern":"Error recovering writer: Downloading the last data chunk file gives incorrect length\\.File length is (.+?) bytes, RecoveryData indicates (.+?) bytes","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/writer/S3RecoverableMultipartUploadFactory.java","lineNumber":99,"sourceCode":"                recoverable.parts(),\n                recoverable.numBytesInParts(),\n                incompletePart);\n    }\n\n    private Optional<File> recoverInProgressPart(S3Recoverable recoverable) throws IOException {\n\n        final String objectKey = recoverable.incompleteObjectName();\n        if (objectKey == null) {\n            return Optional.empty();\n        }\n\n        // download the file (simple way)\n        final RefCountedFileWithStream refCountedFile = tmpFileSupplier.apply(null);\n        final File file = refCountedFile.getFile();\n        final long numBytes = s3AccessHelper.getObject(objectKey, file);\n\n        if (numBytes != recoverable.incompleteObjectLength()) {\n            throw new IOException(\n                    String.format(\n                            \"Error recovering writer: \"\n                                    + \"Downloading the last data chunk file gives incorrect length.\"\n                                    + \"File length is %d bytes, RecoveryData indicates %d bytes\",\n                            numBytes, recoverable.incompleteObjectLength()));\n        }\n\n        return Optional.of(file);\n    }\n\n    private String pathToObjectName(final Path path) {\n        org.apache.hadoop.fs.Path hadoopPath = HadoopFileSystem.toHadoopPath(path);\n        if (!hadoopPath.isAbsolute()) {\n            hadoopPath = new org.apache.hadoop.fs.Path(fs.getWorkingDirectory(), hadoopPath);\n        }\n\n        return hadoopPath.toUri().getScheme() != null && hadoopPath.toUri().getPath().isEmpty()\n                ? \"\"","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/writer/S3RecoverableMultipartUploadFactory.java#L81-L117","documentation":"Error \"Error recovering writer: Downloading the last data chunk file gives incorrect length.File length is %d bytes, RecoveryData indicates %d bytes\" thrown in apache/flink.","triggerScenarios":"Triggered at runtime when the operation fails because: Error recovering writer: Downloading the last data chunk file gives incorrect length.File length is the reported value bytes, RecoveryData indicates the reported value bytes.","commonSituations":"Commonly caused by misconfiguration, missing dependencies or files, unsupported types or operations, or invalid user input leading to: Error recovering writer: Downloading the last data chunk file gives incorrect length.File length is the reported value bytes, RecoveryData indicates the reported value bytes.","solutions":["Address the cause reported by the error message: Error recovering writer: Downloading the last data chunk file gives incorrect length.File length is the reported value bytes, RecoveryData indicates the reported value bytes","Verify the inputs, configuration values, and classpath/dependency setup related to this operation, then retry."],"exampleFix":"Correct the condition described (\"Error recovering writer: Downloading the last data chunk file gives incorrect length.File length is the reported value bytes, RecoveryData indicates the reported value bytes\") and rerun the job or command.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}