{"record":{"id":"da47e880bae3bc82","repo":"paperclipai/paperclip","slug":"git-install-packaging-produced-workspacetarballs","errorCode":null,"errorMessage":"Git install packaging produced ${workspaceTarballs.length} workspace tarballs; expected ${workspacePackages.length}.","messagePattern":"Git install packaging produced (.+?) workspace tarballs; expected (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/install.ts","lineNumber":300,"sourceCode":"    const workspacePackages = resolveGitInstallWorkspacePackages(checkoutPath);\n    for (const [index, workspacePackage] of workspacePackages.entries()) {\n      const packageDir = path.join(checkoutPath, workspacePackage.dir);\n      const packageJson = JSON.parse(fs.readFileSync(path.join(packageDir, \"package.json\"), \"utf8\")) as { bundleDependencies?: string[]; bundledDependencies?: string[] };\n      const bundledDependencies = packageJson.bundleDependencies ?? packageJson.bundledDependencies ?? [];\n      if (bundledDependencies.length > 0) {\n        const stagedPackage = path.join(stagingRoot, `workspace-package-${index}`);\n        await runCommand(process.execPath, [path.join(checkoutPath, \"scripts\", \"prepare-bundled-package.mjs\"), packageDir, stagedPackage], { cwd: checkoutPath, env: buildEnv(), maxBuffer: 32 * 1024 * 1024 });\n        await runCommand(\"npm\", [\"pack\", stagedPackage, \"--pack-destination\", stagingRoot], { cwd: checkoutPath, env: buildEnv(), maxBuffer: 16 * 1024 * 1024 });\n      } else {\n        await runCommand(\"corepack\", [\"pnpm\", \"--dir\", workspacePackage.dir, \"pack\", \"--pack-destination\", stagingRoot], { cwd: checkoutPath, env: buildEnv({ PAPERCLIP_RELEASE_REUSE_UI_DIST: \"1\" }), maxBuffer: 32 * 1024 * 1024 });\n      }\n    }\n    await runCommand(\"npm\", [\"pack\", \"--pack-destination\", stagingRoot], { cwd: path.join(checkoutPath, \"cli\"), env: buildEnv(), maxBuffer: 16 * 1024 * 1024 });\n    const tarballs = fs.readdirSync(stagingRoot).filter((entry) => entry.endsWith(\".tgz\"));\n    const cliTarball = tarballs.find((entry) => entry === `paperclipai-${metadata.version}.tgz`);\n    const workspaceTarballs = tarballs.filter((entry) => entry !== cliTarball);\n    if (!cliTarball || workspaceTarballs.length !== workspacePackages.length) {\n      throw new Error(`Git install packaging produced ${workspaceTarballs.length} workspace tarballs; expected ${workspacePackages.length}.`);\n    }\n    await runCommand(\"npm\", [\"install\", \"--prefix\", stagedPayload, path.join(stagingRoot, cliTarball), ...workspaceTarballs.map((entry) => path.join(stagingRoot, entry)), \"--no-audit\", \"--no-fund\"], { cwd: stagingRoot, maxBuffer: 32 * 1024 * 1024 });\n    await smokePayload(stagedPayload, metadata.version, runCommand);\n    fs.renameSync(stagedPayload, payloadPath);\n    return { payloadPath, reused: false, version: metadata.version };\n  } finally { fs.rmSync(stagingRoot, { recursive: true, force: true }); }\n}\n\nfunction pathContains(directory: string): boolean {\n  const normalized = path.resolve(directory);\n  return (process.env.PATH ?? \"\").split(path.delimiter).filter(Boolean).some((entry) => path.resolve(entry) === normalized);\n}\n\nfunction shellRcPath(): string | null {\n  const home = process.env.HOME;\n  if (!home) return null;\n  const shell = path.basename(process.env.SHELL ?? \"\");\n  if (shell === \"bash\") return path.join(home, \".bashrc\");","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/install.ts#L282-L318","documentation":"Packaging consistency guard for git installs: after staging and packing each workspace package, the number of produced tarballs does not match the number of detected workspace packages, meaning some workspace failed to build or pack and the bundled install would be incomplete.","triggerScenarios":"Thrown at cli/src/commands/install.ts:300 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the git install; if it persists, check the workspace packaging step for failed tarball builds."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}