Tencent/tinker · info · IOException

Error reading data for ${entry.getName()} near offset ${byte

Error message

Error reading data for ${entry.getName()} near offset ${bytesRead}

What it means

This IOException('Error reading data for <entry> near offset <bytesRead>') belongs to the ZipInflaterInputStream inner class, which in this fork of tinker-ziputils is commented out (the block starting '/*public static class ZipInflaterInputStream' at TinkerZipFile.java:569). It was designed to wrap any IOException from the underlying inflater read and add the entry name and the byte offset reached so far, then rethrow with the original as the cause. In this codebase as shipped it is unreachable dead code — the active getInputStream path does not throw this message.

Source

Thrown at third-party/tinker-ziputils/src/main/java/com/tencent/tinker/ziputils/ziputil/TinkerZipFile.java:581

                skip(cnt);
                return len;
            }
        }*/
    }
    /** @hide */
    /*public static class ZipInflaterInputStream extends InflaterInputStream {
        private final ZipEntry entry;
        private long bytesRead = 0;
        public ZipInflaterInputStream(InputStream is, Inflater inf, int bsize, ZipEntry entry) {
            super(is, inf, bsize);
            this.entry = entry;
        }
        @Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
            final int i;
            try {
                i = super.read(buffer, byteOffset, byteCount);
            } catch (IOException e) {
                throw new IOException("Error reading data for " + entry.getName() + " near offset "
                        + bytesRead, e);
            }
            if (i == -1) {
                if (entry.size != bytesRead) {
                    throw new IOException("Size mismatch on inflated file: " + bytesRead + " vs "
                            + entry.size);
                }
            } else {
                bytesRead += i;
            }
            return i;
        }
        @Override public int available() throws IOException {
            if (closed) {
                // Our superclass will throw an exception, but there's a jtreg test that
                // explicitly checks that the InputStream returned from ZipFile.getInputStream
                // returns 0 even when closed.
                return 0;

View on GitHub (pinned to 1b7ea02c23)

Solutions

  1. If you see this message, you are running a build where ZipInflaterInputStream is enabled (e.g. the Android platform zip or an older fork): treat it as data corruption and re-fetch the archive.
  2. In this repository, no action is needed — the code is unreachable; do not add handling for it.
  3. If you are re-enabling the class, keep the cause chain (the original IOException) when logging.
Defensive patterns

Strategy: try-catch

Try / catch

// only relevant on builds where ZipInflaterInputStream is enabled (not this fork)
try {
    int n = in.read(buf);
} catch (IOException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Error reading data for")) {
        // entry data corrupt mid-inflate: the cause holds the real failure
        throw new IOException("Corrupt entry data: " + e.getMessage(), e.getCause());
    }
    throw e;
}

Prevention

When it happens

Trigger: In upstream Android/Harmony (where the class is live): inflating an entry whose DEFLATE stream hits an I/O or data error mid-read, e.g. truncated compressed data or a corrupted deflate block, while reading through ZipFile.getInputStream. In this repository: never thrown, since the class is commented out.

Common situations: Truncated compressed entry bodies in partially downloaded APKs; storage-level read errors; in this fork specifically, searching logs for this message after upgrading from a build where the class was enabled.

Related errors


AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14). Data as JSON: /api/errors/8bf37462928673bf. Report an issue: GitHub.