{"record":{"id":"20f58eb7254de58c","repo":"can1357/oh-my-pi","slug":"unsupported-archive-format-input","errorCode":null,"errorMessage":"Unsupported archive format: ${input}","messagePattern":"Unsupported archive format: (.+?)","errorType":"exception","errorClass":"ArchiveError","httpStatus":null,"severity":"error","filePath":"packages/utils/src/ar/open.ts","lineNumber":48,"sourceCode":"\tformat: ArchiveFormat;\n\tarchivePath?: string;\n}\n\nfunction resolveSource(input: ArchiveSource): ResolvedArchiveSource {\n\tif (typeof input !== \"string\") {\n\t\tif (\"bytes\" in input) {\n\t\t\treturn { source: memoryByteSource(input.bytes), format: input.format };\n\t\t}\n\t\tif (\"source\" in input) {\n\t\t\treturn { source: input.source, format: input.format, archivePath: input.path };\n\t\t}\n\t\tconst format = input.format;\n\t\treturn { source: fileByteSource(input.path), format, archivePath: input.path };\n\t}\n\n\tconst format = archiveFormatFromPath(input);\n\tif (!format) {\n\t\tthrow new ArchiveError(`Unsupported archive format: ${input}`);\n\t}\n\treturn { source: fileByteSource(input), format, archivePath: input };\n}\n\n/**\n * Open an archive for browsing and member reads. File- and source-backed\n * containers with random-access layouts (ZIP, ASAR, RAR, 7z, ISO, CAB) index\n * lazily; stream containers (tar family, cpio, ar) buffer once under limits.\n */\nexport async function openArchive(input: ArchiveSource, options: OpenArchiveOptions = {}): Promise<ArchiveReader> {\n\tconst { source, format, archivePath } = resolveSource(input);\n\tconst limits = { ...DEFAULT_ARCHIVE_LIMITS, ...options.limits };\n\tconst readOptions: FormatReadOptions = { limits, archivePath };\n\tconst entries = await formatReaderFor(format)(source, readOptions);\n\treturn new ArchiveReader(format, entries, limits);\n}\n\n/**","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/open.ts#L30-L66","documentation":"resolveSource was given a plain string path (no explicit format) and archiveFormatFromPath could not map any known archive extension to a format, so openArchive refuses to proceed. The library only auto-detects format from the file extension for string inputs; anything else must be passed as an object with an explicit format. The error message includes the offending path.","triggerScenarios":"Calling openArchive/extractArchive (or related entry points) with a bare string like 'data.bin', 'backup.old.tar', or an extension the registry does not recognize, instead of { path, format } or { bytes, format }.","commonSituations":"Passing a file with an unusual or uppercase/misleading extension, a nested-in-archive path without a recognized archive component, or assuming content sniffing is done for plain paths (it is not — only extensions are used).","solutions":["Rename the file to a recognized archive extension (.zip, .tar, .tgz, .7z, .rar, etc.) matching its actual format.","Pass an explicit source object instead of a string: { path, format: \"tar\" } (or the correct ArchiveFormat).","For in-memory data, use { bytes, format } so no extension is needed.","Check the registry's supported extensions (ARCHIVE_EXTENSION_ALTERNATION in packages/utils/src/ar/registry.ts) and align the input."],"exampleFix":"// before\nawait openArchive(\"./data/pack.bin\");\n// after\nawait openArchive({ path: \"./data/pack.bin\", format: \"zip\" });","handlingStrategy":"validation","validationCode":"const KNOWN = /\\.(zip|tar|tgz|tar\\.gz|tar\\.bz2|tar\\.xz|7z|rar|asar|iso|cab|arj|cpio|ar|lzh)$/i;\nif (typeof input === \"string\" && !KNOWN.test(input)) {\n  throw new Error(`Pass an explicit format: openArchive({ path: ${JSON.stringify(input)}, format: \"...\" })`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const reader = await openArchive(input);\n} catch (err) {\n  if (err instanceof ArchiveError && err.message.startsWith(\"Unsupported archive format:\")) {\n    // fall back to explicit-format open or inform the user\n  }\n  throw err;\n}","preventionTips":["Always pass { path, format } objects when the extension may be missing or unusual.","Use { bytes, format } for in-memory buffers to skip extension detection entirely.","Keep a registry check (archiveFormatFromPath) in app startup to validate user-supplied paths early.","Normalize file extensions on ingest (e.g. rename .bin archives to their real extension)."],"tags":["archive","unsupported-format","path-extension","api-misuse"],"backgroundTag":"unsupported-archive-format","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}