{"record":{"id":"f8935e82acf5da76","repo":"paperclipai/paperclip","slug":"package-package-json-not-found-at-packagejsonpat","errorCode":null,"errorMessage":"Package package.json not found at ${packageJsonPath}","messagePattern":"Package package\\.json not found at (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/plugins/create-paperclip-plugin/src/index.ts","lineNumber":93,"sourceCode":"}\n\nfunction getRepoRootFromSdkPath(sdkPath: string): string {\n  return path.resolve(sdkPath, \"..\", \"..\", \"..\");\n}\n\nfunction getLocalSharedPackagePath(sdkPath: string): string {\n  return path.resolve(getRepoRootFromSdkPath(sdkPath), \"packages\", \"shared\");\n}\n\nfunction isInsideDir(targetPath: string, parentPath: string): boolean {\n  const relative = path.relative(parentPath, targetPath);\n  return relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative));\n}\n\nfunction packLocalPackage(packagePath: string, outputDir: string): string {\n  const packageJsonPath = path.join(packagePath, \"package.json\");\n  if (!fs.existsSync(packageJsonPath)) {\n    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}`);","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/packages/plugins/create-paperclip-plugin/src/index.ts#L75-L111","documentation":"Precondition check in packLocalPackage: the helper was asked to pack a local workspace package (e.g. packages/shared) but no package.json exists at the resolved package path. This usually means the create-paperclip-plugin scaffolder ran from a repo checkout where the SDK's relative path to the monorepo package is wrong, or the package directory is missing/misnamed.","triggerScenarios":"Thrown at packages/plugins/create-paperclip-plugin/src/index.ts:93 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the command from the package directory (or pass the correct path) so package.json exists at the expected location."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}