diegosouzapw/OmniRoute · error

ZIP archive contains no .json files

Error message

ZIP archive contains no .json files

What it means

extractJsonZip successfully decompressed the uploaded archive but found zero entries whose (case-insensitive) name ends in .json. The upload is a valid ZIP, just one that contains no JSON payload — e.g. a user zipped the wrong folder or exported a non-JSON backup.

Solutions

  1. Upload the ZIP that actually contains auth.json (e.g. the Codex config export)
  2. Check the JSON files were not renamed to another extension
  3. Import a bare auth.json file instead of a ZIP if that is what you have
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/oauth/utils/jsonZipExtract.ts:46 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/4ad3f83549bb301d. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/oauth/utils/jsonZipExtract.ts:46

  zipBuffer: Buffer,
  options: ExtractZipOptions = {}
): ExtractedZipFile[] {
  const maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;
  const maxFileSize = options.maxFileSizeBytes ?? DEFAULT_MAX_FILE_SIZE;
  const maxTotal = options.maxTotalSizeBytes ?? DEFAULT_MAX_TOTAL;

  let unzipped: Unzipped;
  try {
    unzipped = unzipSync(new Uint8Array(zipBuffer));
  } catch {
    throw new Error("Could not parse ZIP archive — file may be corrupt or not a valid ZIP");
  }

  const entries = Object.entries(unzipped).filter(([, data]) => data !== undefined);
  const jsonEntries = entries.filter(([name]) => name.toLowerCase().endsWith(".json"));

  if (jsonEntries.length === 0) {
    throw new Error("ZIP archive contains no .json files");
  }

  if (jsonEntries.length > maxFiles) {
    throw new Error(
      `ZIP archive contains ${jsonEntries.length} .json files — max allowed is ${maxFiles}`
    );
  }

  let totalBytes = 0;
  const result: ExtractedZipFile[] = [];

  for (const [entryName, data] of jsonEntries) {
    const baseName = path.basename(entryName);

    if (!isSafeEntryName(baseName)) {
      throw new Error(
        `ZIP entry "${baseName}" has an unsafe filename (must be a .json file without path traversal)`
      );

View on GitHub (pinned to a179ffed5b)