google-gemini/gemini-cli · error · Error

Unsupported file extension for extraction: ${file}

Error message

Unsupported file extension for extraction: ${file}

What it means

Thrown by extractFile() when the archive name is neither .tar.gz (handled by tar.x) nor .zip (handled by extract). The function is used to unpack downloaded release assets, so any other archive format is unsupported.

Source

Thrown at packages/cli/src/config/extensions/github.ts:573

        }
        const file = fs.createWriteStream(dest);
        res.pipe(file);
        file.on('finish', () => file.close(resolve as () => void));
      })
      .on('error', reject);
  });
}

export async function extractFile(file: string, dest: string): Promise<void> {
  if (file.endsWith('.tar.gz')) {
    await tar.x({
      file,
      cwd: dest,
    });
  } else if (file.endsWith('.zip')) {
    await extract(file, { dir: dest });
  } else {
    throw new Error(`Unsupported file extension for extraction: ${file}`);
  }
}

View on GitHub (pinned to 5024443c72)

Solutions

  1. Repackage the asset as .tar.gz or .zip on the release.
  2. Add a branch to extractFile for the new format and a matching extractor dependency.
  3. Normalize the filename to lowercase before the endsWith checks if case is the issue.

Example fix

// before
if (file.endsWith('.tar.gz')) { ... } else if (file.endsWith('.zip')) { ... } else throw ...;
// after
const lower = file.toLowerCase();
if (lower.endsWith('.tar.gz')) { ... } else if (lower.endsWith('.tgz')) { ... } else if (lower.endsWith('.zip')) { ... } else throw ...;
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = ['.tar.gz', '.zip'];
function isSupportedArchive(file: string): boolean {
  const f = file.toLowerCase();
  return SUPPORTED.some((ext) => f.endsWith(ext));
}

Type guard

function isSupportedArchive(file: string): boolean { const f = file.toLowerCase(); return f.endsWith('.tar.gz') || f.endsWith('.zip'); }

Prevention

When it happens

Trigger: A GitHub release asset with an extension like .tar, .tar.bz2, .gz (non-tarball), .7z, .rar, or no extension is passed to extractFile.

Common situations: An extension publishes assets in a format the installer does not handle; a release provides a single-file .gz rather than a .tar.gz; case-sensitive extension mismatch (.ZIP, .TAR.GZ).

Related errors


AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12). Data as JSON: /api/errors/3f4d5116ab467233. Report an issue: GitHub.