{"record":{"id":"fa1aacbb4505e80d","repo":"can1357/oh-my-pi","slug":"unsupported-embedded-addon-archive-entry-type-ty","errorCode":null,"errorMessage":"Unsupported embedded addon archive entry type ${typeflag}: ${filename}","messagePattern":"Unsupported embedded addon archive entry type (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/natives/native/loader-state.js","lineNumber":530,"sourceCode":"\tlet offset = 0;\n\n\twhile (offset + 512 <= archive.length) {\n\t\tif (isZeroTarBlock(archive, offset)) break;\n\t\tconst header = archive.subarray(offset, offset + 512);\n\t\tconst filename = getTarEntryName(header);\n\t\tconst size = readTarOctal(header, 124, 12);\n\t\tconst typeflag = header[156] === 0 ? \"0\" : String.fromCharCode(header[156]);\n\t\toffset += 512;\n\n\t\tif (offset + size > archive.length) {\n\t\t\tthrow new Error(`Truncated embedded addon archive entry: ${filename}`);\n\t\t}\n\n\t\tif (!isSafeEmbeddedAddonFilename(filename)) {\n\t\t\tthrow new Error(`Unsafe embedded addon archive entry: ${filename}`);\n\t\t}\n\t\tif (typeflag !== \"0\") {\n\t\t\tthrow new Error(`Unsupported embedded addon archive entry type ${typeflag}: ${filename}`);\n\t\t}\n\n\t\tconst file = pending.get(filename);\n\t\tif (file) {\n\t\t\tif (typeof file.size === \"number\" && file.size !== size) {\n\t\t\t\tthrow new Error(`Embedded addon size mismatch for ${filename}: expected ${file.size}, got ${size}`);\n\t\t\t}\n\t\t\tconst targetPath = path.join(targetDir, filename);\n\t\t\twriteEmbeddedAddonFile(targetPath, archive.subarray(offset, offset + size));\n\t\t\tpending.delete(filename);\n\t\t\twrittenPaths.push(targetPath);\n\t\t}\n\n\t\toffset += Math.ceil(size / 512) * 512;\n\t}\n\n\tif (pending.size > 0) {\n\t\tthrow new Error(`Embedded addon archive missing: ${[...pending.keys()].join(\", \")}`);","sourceCodeStart":512,"sourceCodeEnd":548,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/natives/native/loader-state.js#L512-L548","documentation":"The embedded addon archive may only contain regular files. Any tar entry whose typeflag (header byte 156) is not '0' — e.g. '5' (directory), 'L' (GNU long name), 'x'/'g' (PAX extended headers), symlinks — is rejected with this error naming the typeflag and entry name.","triggerScenarios":"extractEmbeddedAddonArchive reads a tar entry whose typeflag is anything other than '0': directories inside the archive, GNU longname ('L') or PAX ('x') metadata entries produced by tar variants, symlinks ('2'), etc.","commonSituations":"An addon .tar.gz created with a different tar implementation that emits PAX/GNU metadata headers; packaging script archived a directory tree instead of flat files; a symlinked .node file was packed.","solutions":["Repack with plain regular files only: tar --format=ustar -czf addon.tar.gz pi_natives.node (ustar avoids PAX/GNU extra entries).","Ensure the staging directory contains only the .node files, no subdirectories or symlinks.","Reinstall omp to restore the official archive."],"exampleFix":"// before\n$ tar -czf addon.tar.gz pi_natives.node   # GNU tar may emit PAX headers\n// after\n$ tar --format=ustar -czf addon.tar.gz pi_natives.node","handlingStrategy":"validation","validationCode":"import { execFileSync } from \"node:child_process\";\nfunction assertRegularFileEntriesOnly(archivePath) {\n  const listing = execFileSync(\"tar\", [\"-tvzf\", archivePath], { encoding: \"utf8\" });\n  for (const line of listing.split(\"\\n\")) {\n    if (line && !line.startsWith(\"-\")) {\n      throw new Error(`Non-regular tar entry: ${line}`);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  extractEmbeddedAddonArchive({ archivePath, files, targetDir });\n} catch (err) {\n  const m = err.message.match(/Unsupported embedded addon archive entry type (\\S+):/);\n  if (m) {\n    // repack with --format=ustar and regular files only, then retry once\n  } else throw err;\n}","preventionTips":["Create embedded archives with --format=ustar to suppress PAX/GNU metadata entries.","Only pack regular files — exclude directories, symlinks, and dotfiles from staging.","Run tar -tvzf in CI and assert every entry type is a regular file."],"tags":["tar","archive","unsupported-entry","packaging"],"backgroundTag":"unsupported-archive-entry-type","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}