arduino/Arduino · error · IOException

Archive format not supported.

Error message

Archive format not supported.

What it means

ArchiveExtractor.extract supports gzip-compressed tar (tar.gz/tgz), xz-compressed tar, and plain tar archives. If the archive file's name matches none of those suffixes, it throws this IOException. The format detection is purely filename-extension based; there is no content sniffing.

Source

Thrown at arduino-core/src/cc/arduino/utils/ArchiveExtractor.java:107

    // (because creating a file in a folder alters the folder's timestamp)
    Map<File, Long> foldersTimestamps = new HashMap<>();

    ArchiveInputStream in = null;
    try {

      // Create an ArchiveInputStream with the correct archiving algorithm
      if (archiveFile.getName().endsWith("tar.bz2")) {
        in = new TarArchiveInputStream(new BZip2CompressorInputStream(new FileInputStream(archiveFile)));
      } else if (archiveFile.getName().endsWith("zip")) {
        in = new ZipArchiveInputStream(new FileInputStream(archiveFile));
      } else if (archiveFile.getName().endsWith("tar.gz")) {
        in = new TarArchiveInputStream(new GzipCompressorInputStream(new FileInputStream(archiveFile)));
      } else if (archiveFile.getName().endsWith("tar.xz")) {
        in = new TarArchiveInputStream(new XZCompressorInputStream(new FileInputStream(archiveFile)));
      } else if (archiveFile.getName().endsWith("tar")) {
        in = new TarArchiveInputStream(new FileInputStream(archiveFile));
      } else {
        throw new IOException("Archive format not supported.");
      }

      String pathPrefix = "";

      Map<File, File> hardLinks = new HashMap<>();
      Map<File, Integer> hardLinksMode = new HashMap<>();
      Map<File, String> symLinks = new HashMap<>();
      Map<File, Long> symLinksModifiedTimes = new HashMap<>();

      // Cycle through all the archive entries
      while (true) {
        ArchiveEntry entry = in.getNextEntry();
        if (entry == null) {
          break;
        }

        // Extract entry info
        long size = entry.getSize();

View on GitHub (pinned to a0df6e0e83)

Solutions

  1. Repackage the library/archive as a .tar.gz (or .tar/.tar.xz) archive with the correct extension
  2. Rename the file to match its actual format if it is truly a tar-family archive (e.g. add the missing .tar.gz suffix)
  3. For zip archives, extract with an unzip tool first and install the folder manually into the libraries/ directory

Example fix

// before
new ArchiveExtractor().extract(tempFile, destDir, 1); // tempFile = mylib.zip
// after
new ArchiveExtractor().extract(new File("mylib.tar.gz"), destDir, 1);
Defensive patterns

Strategy: validation

Validate before calling

String n = archiveFile.getName();
boolean supported = n.endsWith(".tar.gz") || n.endsWith(".tgz") || n.endsWith(".tar.xz") || n.endsWith(".tar");
if (!supported) throw new IllegalArgumentException("Repackage as tar.gz before extracting: " + n);

Try / catch

try { extractor.extract(archive, dest, 1); } catch (IOException e) { if (e.getMessage().contains("Archive format not supported")) { convertOrUnzipManually(archive, dest); } else { throw e; } }

Prevention

When it happens

Trigger: extract() is called with a file whose name does not end in .tar.gz/.tgz, .tar.xz, or .tar — e.g. a .zip file, a .7z, or a tarball with an unusual/missing extension.

Common situations: Library Manager downloading an archive in an unsupported format (zip instead of tar.gz); a library author packaging releases as zip; an archive renamed so its extension no longer reflects its format.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of arduino/Arduino@a0df6e0e83 (2026-09-06). Data as JSON: /api/errors/a42ea6dde31f8f3f. Report an issue: GitHub.