{"record":{"id":"cd5feb37b95199a4","repo":"diegosouzapw/OmniRoute","slug":"could-not-parse-zip-archive-file-may-be-corrupt","errorCode":null,"errorMessage":"Could not parse ZIP archive — file may be corrupt or not a valid ZIP","messagePattern":"Could not parse ZIP archive — file may be corrupt or not a valid ZIP","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/oauth/utils/jsonZipExtract.ts","lineNumber":39,"sourceCode":"  if (name.includes(\"..\")) return false;\n  if (path.isAbsolute(name)) return false;\n  if (/[\\r\\n\\0]/.test(name)) return false;\n  return true;\n}\n\nexport function extractJsonZip(\n  zipBuffer: Buffer,\n  options: ExtractZipOptions = {}\n): ExtractedZipFile[] {\n  const maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;\n  const maxFileSize = options.maxFileSizeBytes ?? DEFAULT_MAX_FILE_SIZE;\n  const maxTotal = options.maxTotalSizeBytes ?? DEFAULT_MAX_TOTAL;\n\n  let unzipped: Unzipped;\n  try {\n    unzipped = unzipSync(new Uint8Array(zipBuffer));\n  } catch {\n    throw new Error(\"Could not parse ZIP archive — file may be corrupt or not a valid ZIP\");\n  }\n\n  const entries = Object.entries(unzipped).filter(([, data]) => data !== undefined);\n  const jsonEntries = entries.filter(([name]) => name.toLowerCase().endsWith(\".json\"));\n\n  if (jsonEntries.length === 0) {\n    throw new Error(\"ZIP archive contains no .json files\");\n  }\n\n  if (jsonEntries.length > maxFiles) {\n    throw new Error(\n      `ZIP archive contains ${jsonEntries.length} .json files — max allowed is ${maxFiles}`\n    );\n  }\n\n  let totalBytes = 0;\n  const result: ExtractedZipFile[] = [];\n","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/utils/jsonZipExtract.ts#L21-L57","documentation":"Error \"Could not parse ZIP archive — file may be corrupt or not a valid ZIP\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/oauth/utils/jsonZipExtract.ts:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}