paperclipai/paperclip · error · Error

Failed to prepare workspace build artifacts before starting…

Error message

Failed to prepare workspace build artifacts before starting the Paperclip dev server.

What it means

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.

Solutions

  1. Run the workspace build manually to see the failure, fix it, and retry.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at cli/src/commands/run.ts:179 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-08-18). Data as JSON: /api/errors/b5e859e02a514ad1. Report an issue: GitHub.

Appendix: source

Thrown at cli/src/commands/run.ts:205

  if (moduleMatch?.[1]) return moduleMatch[1];
  return null;
}

function maybeEnableUiDevMiddleware(entrypoint: string): void {
  if (process.env.PAPERCLIP_UI_DEV_MIDDLEWARE !== undefined) return;
  const normalized = entrypoint.replaceAll("\\", "/");
  if (normalized.endsWith("/server/src/index.ts") || normalized.endsWith("@paperclipai/server/src/index.ts")) {
    process.env.PAPERCLIP_UI_DEV_MIDDLEWARE = "true";
  }
}

function ensureDevWorkspaceBuildDeps(projectRoot: string): void {
  const buildScript = path.resolve(projectRoot, "scripts/ensure-plugin-build-deps.mjs");
  if (!fs.existsSync(buildScript)) return;

  const result = spawnSync(process.execPath, [buildScript], {
    cwd: projectRoot,
    stdio: "inherit",
    timeout: 120_000,
  });

  if (result.error) {
    throw new Error(
      `Failed to prepare workspace build artifacts before starting the Paperclip dev server.\n${formatError(result.error)}`,
    );
  }

  if ((result.status ?? 1) !== 0) {
    throw new Error(
      "Failed to prepare workspace build artifacts before starting the Paperclip dev server.",
    );
  }
}

async function importServerEntry(): Promise<StartedServer> {
  // Dev mode: try local workspace path (monorepo with tsx)

View on GitHub (pinned to 01ad858492)