{"record":{"id":"e2a639075342ff4c","repo":"paperclipai/paperclip","slug":"packed-tarball-was-not-created-at-tarballpath","errorCode":null,"errorMessage":"Packed tarball was not created at ${tarballPath}","messagePattern":"Packed tarball was not created at (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugins/create-paperclip-plugin/src/index.ts","lineNumber":111,"sourceCode":"    throw new Error(`Package package.json not found at ${packageJsonPath}`);\n  }\n\n  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\")) as {\n    name?: string;\n    version?: string;\n  };\n  const packageName = packageJson.name ?? path.basename(packagePath);\n  const packageVersion = packageJson.version ?? \"0.0.0\";\n  const tarballFileName = `${packageName.replace(/^@/, \"\").replace(\"/\", \"-\")}-${packageVersion}.tgz`;\n  const sdkBundleDir = path.join(outputDir, \".paperclip-sdk\");\n\n  fs.mkdirSync(sdkBundleDir, { recursive: true });\n  execFileSync(\"pnpm\", [\"build\"], { cwd: packagePath, stdio: \"pipe\" });\n  execFileSync(\"pnpm\", [\"pack\", \"--pack-destination\", sdkBundleDir], { cwd: packagePath, stdio: \"pipe\" });\n\n  const tarballPath = path.join(sdkBundleDir, tarballFileName);\n  if (!fs.existsSync(tarballPath)) {\n    throw new Error(`Packed tarball was not created at ${tarballPath}`);\n  }\n\n  return tarballPath;\n}\n\n/**\n * Generate a complete Paperclip plugin starter project.\n *\n * Output includes manifest/worker/UI entries, SDK harness tests, bundler presets,\n * and a local dev server script for hot-reload workflow.\n */\nexport function scaffoldPluginProject(options: ScaffoldPluginOptions): string {\n  const template = options.template ?? \"default\";\n  if (!VALID_TEMPLATES.includes(template)) {\n    throw new Error(`Invalid template '${template}'. Expected one of: ${VALID_TEMPLATES.join(\", \")}`);\n  }\n\n  if (!isValidPluginName(options.pluginName)) {","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/plugins/create-paperclip-plugin/src/index.ts#L93-L129","documentation":"After packLocalPackage runs pnpm build and pnpm pack --pack-destination <dir>, it constructs the expected tarball filename from package.json name/version and checks existence. If the file is not there, the pack step produced a different filename than expected — almost always a name/version mismatch between what was read and what pnpm pack emitted.","triggerScenarios":"package.json name/version read by the scaffolder does not match what pnpm pack actually wrote — e.g. a 'prepare'/'prepack' script mutated the package, a pnpm workspace version pinning overrode the version, or name scoping differs (the .replace calls assume @scope/name -> scope-name format).","commonSituations":"packages/shared has a prepack script; pnpm workspace 'catalog:' or 'workspace:' protocol rewrote the version at pack time; the package uses a name format the replace regex doesn't normalize the same way pnpm does.","solutions":["Run 'pnpm pack --pack-destination /tmp' in the package dir and compare the emitted filename to tarballFileName.","Check for prepack/prepare scripts that change name or version, and account for them.","If using pnpm workspace catalog versioning, ensure package.json 'version' is a concrete semver, not a workspace reference."],"exampleFix":"# diagnose\n$ cd packages/shared && pnpm pack --pack-destination /tmp\n# observe actual tarball name vs expected, fix version/source of mismatch","handlingStrategy":"validation","validationCode":"import { execFileSync } from 'node:child_process';\nfunction expectedTarballName(pkgDir: string): string {\n  const pj = JSON.parse(fs.readFileSync(path.join(pkgDir,'package.json'),'utf8'));\n  const name = (pj.name ?? path.basename(pkgDir)).replace(/^@/, '').replace('/', '-');\n  const version = pj.version ?? '0.0.0';\n  return `${name}-${version}.tgz`;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run 'pnpm pack' manually first to learn the real emitted filename.","Avoid prepack/prepare scripts that mutate name or version.","Pin a concrete version in package.json (no workspace: protocol) before packing."],"tags":["scaffolding","build","packaging","pnpm","create-paperclip-plugin"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}