{"record":{"id":"b5e859e02a514ad1","repo":"paperclipai/paperclip","slug":"failed-to-prepare-workspace-build-artifacts-before-b5e859","errorCode":null,"errorMessage":"Failed to prepare workspace build artifacts before starting the Paperclip dev server.","messagePattern":"Failed to prepare workspace build artifacts before starting the Paperclip dev server\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/run.ts","lineNumber":205,"sourceCode":"  if (moduleMatch?.[1]) return moduleMatch[1];\n  return null;\n}\n\nfunction maybeEnableUiDevMiddleware(entrypoint: string): void {\n  if (process.env.PAPERCLIP_UI_DEV_MIDDLEWARE !== undefined) return;\n  const normalized = entrypoint.replaceAll(\"\\\\\", \"/\");\n  if (normalized.endsWith(\"/server/src/index.ts\") || normalized.endsWith(\"@paperclipai/server/src/index.ts\")) {\n    process.env.PAPERCLIP_UI_DEV_MIDDLEWARE = \"true\";\n  }\n}\n\nfunction ensureDevWorkspaceBuildDeps(projectRoot: string): void {\n  const buildScript = path.resolve(projectRoot, \"scripts/ensure-plugin-build-deps.mjs\");\n  if (!fs.existsSync(buildScript)) return;\n\n  const result = spawnSync(process.execPath, [buildScript], {\n    cwd: projectRoot,\n    stdio: \"inherit\",\n    timeout: 120_000,\n  });\n\n  if (result.error) {\n    throw new Error(\n      `Failed to prepare workspace build artifacts before starting the Paperclip dev server.\\n${formatError(result.error)}`,\n    );\n  }\n\n  if ((result.status ?? 1) !== 0) {\n    throw new Error(\n      \"Failed to prepare workspace build artifacts before starting the Paperclip dev server.\",\n    );\n  }\n}\n\nasync function importServerEntry(): Promise<StartedServer> {\n  // Dev mode: try local workspace path (monorepo with tsx)","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/run.ts#L187-L223","documentation":"ensureDevWorkspaceBuildDeps ran scripts/ensure-plugin-build-deps.mjs and it exited non-zero, so workspace build artifacts are not ready and the dev server cannot be started safely.","triggerScenarios":"Thrown at cli/src/commands/run.ts:179 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the workspace build manually to see the failure, fix it, and retry."],"exampleFix":null,"handlingStrategy":"try-catch","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"}