{"record":{"id":"ed6dc6e6cb402382","repo":"Yeachan-Heo/oh-my-codex","slug":"archive-format-unsupported","errorCode":"archive_format_unsupported","errorMessage":"[native-assets] archive_format_unsupported: ${archivePath}","messagePattern":"\\[native-assets\\] archive_format_unsupported: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/native-assets/archive.ts","lineNumber":35,"sourceCode":"  /** Original archive member name, retained for diagnostics and exact extraction. */\n  rawName: string;\n  /** Safe, separator-normalized logical member name. */\n  normalizedName: string;\n  /** @deprecated Use normalizedName. */\n  path: string;\n  type: NativeArchiveEntryType;\n  size: number;\n}\n\nfunction archiveError(code: string, detail: string): Error {\n  return new Error(`[native-assets] ${code}: ${detail}`);\n}\n\nfunction archiveFormat(archivePath: string): 'tar.xz' | 'tar.gz' | 'zip' {\n  if (/\\.tar\\.xz$/i.test(archivePath)) return 'tar.xz';\n  if (/\\.tar\\.gz$/i.test(archivePath)) return 'tar.gz';\n  if (/\\.zip$/i.test(archivePath)) return 'zip';\n  throw archiveError('archive_format_unsupported', archivePath);\n}\n\nfunction entry(rawName: string, type: NativeArchiveEntryType, size: number): NativeArchiveEntry {\n  if (!Number.isSafeInteger(size) || size < 0) throw archiveError('archive_inspection_failed', `invalid entry size: ${rawName}`);\n  const normalizedName = normalizeNativeArchivePath(rawName, type);\n  return { rawName, normalizedName, path: normalizedName, type, size };\n}\n\nasync function tarInput(archivePath: string, format: 'tar.xz' | 'tar.gz'): Promise<Readable> {\n  try {\n    const archive = readFileSync(archivePath);\n    return Readable.from(format === 'tar.gz' ? gunzipSync(archive) : await decompress(archive));\n  } catch (error) {\n    throw archiveError('archive_inspection_failed', error instanceof Error ? error.message : archivePath);\n  }\n}\n\nasync function inspectTar(archivePath: string, format: 'tar.xz' | 'tar.gz'): Promise<NativeArchiveEntry[]> {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/native-assets/archive.ts#L17-L53","documentation":"The native-assets archive inspector only supports .tar.xz, .tar.gz, and .zip archives, detected purely by file extension (case-insensitive). archiveFormat throws archive_format_unsupported when the path matches none of those suffixes, before any file I/O occurs. Rename the file (or repackage it) so the extension reflects a supported format.","triggerScenarios":"Passing an archive path ending in something other than .tar.xz/.tar.gz/.zip (e.g. .tgz, .tar.bz2, .7z, .tar, no extension, or double extensions like .tar.gz.sig) to inspectNativeArchive/format.","commonSituations":"Feeding .tgz files (a common gzip-tar alias that is not recognized here); downloading artifacts with mangled names; users supplying .7z/.tar.bz2 archives; CI renaming artifacts to include hashes before the extension.","solutions":["Rename .tgz to .tar.gz (or repackage) since the checker matches only literal suffixes","Repackage unsupported formats (7z, bz2, plain tar) into zip/tar.gz/tar.xz","Validate the extension in caller code before invoking the inspector"],"exampleFix":"// before\nconst entries = await inspectArchive(path.join(dir, 'bundle.tgz')); // throws archive_format_unsupported\n\n// after\nconst fixed = path.join(dir, 'bundle.tar.gz');\nawait fs.rename(path.join(dir, 'bundle.tgz'), fixed);\nconst entries = await inspectArchive(fixed);","handlingStrategy":"validation","validationCode":"const SUPPORTED = /\\.(tar\\.xz|tar\\.gz|zip)$/i;\nif (!SUPPORTED.test(archivePath)) throw new Error(`Unsupported archive: ${archivePath}`);\n// normalize common alias\nif (/\\.tgz$/i.test(archivePath)) archivePath = archivePath.replace(/\\.tgz$/i, '.tar.gz');","typeGuard":"function isSupportedArchive(p: string): boolean {\n  return /\\.(tar\\.xz|tar\\.gz|zip)$/i.test(p);\n}","tryCatchPattern":"catch (e) {\n  if (e?.code === 'archive_format_unsupported') { /* repackage or rename then retry */ } else throw e;\n}","preventionTips":["Normalize archive names before inspection (.tgz -> .tar.gz)","Repackage 7z/bz2/tar inputs into supported formats upstream","Verify checksums and names when downloading artifacts in CI"],"tags":["native-assets","archive","validation","file-extension"],"backgroundTag":"unsupported-file-format","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}