# java.util.zip.ZipException: ZIP file must have at least one entry

- **ID:** `java/zip-exception-unsupported-feature`
- **Domain:** java
- **Category:** io_error
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

ZipException is thrown when attempting to read or process a ZIP file that is empty (contains no entries), often due to a failed download or corrupted archive creation.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Java 8 | active | — | — |
| Java 11 | active | — | — |
| Java 17 | active | — | — |
| Java 21 | active | — | — |

## Workarounds

1. **Verify the ZIP file integrity by checking its size and content before processing: if (zipFile.size() == 0) { throw new IOException("Empty ZIP file"); } else { try (ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile))) { ZipEntry entry = zis.getNextEntry(); if (entry == null) { throw new IOException("ZIP file has no entries"); } } }** (95% success)
   ```
   Verify the ZIP file integrity by checking its size and content before processing: if (zipFile.size() == 0) { throw new IOException("Empty ZIP file"); } else { try (ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile))) { ZipEntry entry = zis.getNextEntry(); if (entry == null) { throw new IOException("ZIP file has no entries"); } } }
   ```
2. **Re-download or regenerate the ZIP file from the source, ensuring the transfer is complete and the file is not truncated. Use checksums (e.g., MD5) to verify integrity.** (90% success)
   ```
   Re-download or regenerate the ZIP file from the source, ensuring the transfer is complete and the file is not truncated. Use checksums (e.g., MD5) to verify integrity.
   ```

## Dead Ends

- **** — ZIP files have a specific structure; manual edits without understanding the format usually result in an invalid archive. (80% fail)
- **** — The underlying issue (failed download or generation) remains unsolved; the new file may also be empty. (90% fail)
