{"record":{"id":"fdf52d44edd85a6a","repo":"can1357/oh-my-pi","slug":"invalid-archive-link","errorCode":null,"errorMessage":"Invalid archive link","messagePattern":"Invalid archive link","errorType":"exception","errorClass":"ArchiveError","httpStatus":null,"severity":"error","filePath":"packages/utils/src/ar/tar.ts","lineNumber":362,"sourceCode":"\tconst findUnresolvedBlocker = (targetPath: string): ArchiveIndexEntry | null => {\n\t\tfor (let end = targetPath.length; end > 0; end = targetPath.lastIndexOf(\"/\", end - 1)) {\n\t\t\tconst prefixEntry = entries.get(targetPath.slice(0, end));\n\t\t\tif (prefixEntry && unresolved.has(prefixEntry)) return prefixEntry;\n\t\t}\n\t\treturn null;\n\t};\n\tconst queue = [...unresolved];\n\twhile (queue.length > 0) {\n\t\tconst entry = queue.pop()!;\n\t\tif (!unresolved.has(entry)) continue;\n\t\tconst pending = pendingLinks.get(entry)!;\n\t\tlet blocker = findUnresolvedBlocker(pending.targetPath);\n\t\tlet targetPath = pending.targetPath;\n\t\tif (blocker === null) {\n\t\t\ttry {\n\t\t\t\ttargetPath = resolveArchiveLinkPath(entries, targetPath, limits.maxLinkDepth);\n\t\t\t} catch (error) {\n\t\t\t\tif (!(error instanceof ArchiveError)) throw new ArchiveError(\"Invalid archive link\");\n\t\t\t}\n\t\t\tif (targetPath !== pending.targetPath) blocker = findUnresolvedBlocker(targetPath);\n\t\t}\n\t\tif (blocker !== null && blocker !== entry) {\n\t\t\tconst waiting = dependents.get(blocker);\n\t\t\tif (waiting) waiting.push(entry);\n\t\t\telse dependents.set(blocker, [entry]);\n\t\t\tcontinue;\n\t\t}\n\t\tunresolved.delete(entry);\n\t\tconst settled = dependents.get(entry);\n\t\tif (settled) {\n\t\t\tdependents.delete(entry);\n\t\t\tqueue.push(...settled);\n\t\t}\n\t\tif (blocker === entry) {\n\t\t\tif (pending.kind === \"hard link\") {\n\t\t\t\tthrow new ArchiveError(","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/tar.ts#L344-L380","documentation":"Wraps a non-ArchiveError failure from resolveArchiveLinkPath into a generic ArchiveError(\"Invalid archive link\") during pending-link resolution. It means link-target resolution failed in an unexpected way while settling a tar symlink/hard-link entry.","triggerScenarios":"During resolvePendingLinks, resolveArchiveLinkPath(entries, targetPath, maxLinkDepth) throws something that is not an ArchiveError (e.g. a RangeError from runaway recursion or an internal bug), so the catch block re-wraps it.","commonSituations":"Pathological archives with deeply nested or self-referential symlink chains that trip the depth limit via an unexpected error type; library-internal edge cases.","solutions":["Inspect the original error by catching ArchiveError and checking message context; enable debug logging to see the failing link.","Examine the archive's link structure (`tar tvf`) for unusually deep symlink chains and re-pack without them.","Report a bug with the offending archive if a normal archive triggers it — non-ArchiveError escapes here suggest a library defect."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await readTar(bytes, opts);\n} catch (e) {\n  if (e instanceof ArchiveError && e.message === \"Invalid archive link\") {\n    logger.error(\"tar link resolution failed unexpectedly\", { error: e });\n    throw new Error(\"Archive link graph could not be resolved\");\n  }\n  throw e;\n}","preventionTips":["Avoid archives with deep or chained symlink structures.","Re-pack with `tar -h` (dereference) when link graphs are complex.","Report reproducible cases to the library maintainers — this wraps non-ArchiveError bugs."],"tags":["archive","tar","symlink","link-resolution"],"backgroundTag":"invalid-archive-link","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}