paperclipai/paperclip · error

Internal server error

Error message

Internal server error

What it means

Terminal branch of the central Express error handler: an unhandled non-Zod error escaped a route handler. The middleware scrubs it to an opaque 500 'Internal server error', attaches error context for diagnostics, and reports the crash code to telemetry before responding.

Solutions

  1. Check the server logs for the underlying exception, fix the cause, and retry the request.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at server/src/middleware/error-handler.ts:146 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of paperclipai/paperclip@3f1d897a7c (2026-09-18). Data as JSON: /api/errors/c582853139339658. Report an issue: GitHub.

Appendix: source

Thrown at server/src/middleware/error-handler.ts:273

  attachErrorContext(
    req,
    res,
    isSecretSensitiveHttpRequest(req.method, req.originalUrl)
      ? { message: reportableError.message, name: reportableError.name }
      : err instanceof Error
        ? { message: err.message, stack: err.stack, name: err.name }
        : {
            message: String(err),
            raw: err,
            stack: rootError.stack,
            name: rootError.name,
          },
    reportableError,
  );

  reportCrash(reportableError);

  res.status(500).json({
    error: "Internal server error",
    ...(shouldExposeTrustedCloudTenantImportError(req)
      ? { message: rootError.message }
      : {}),
  });
}

function shouldExposeTrustedCloudTenantImportError(req: Request) {
  return (
    req.actor?.source === "cloud_tenant" &&
    req.method === "POST" &&
    req.originalUrl.split("?")[0] === COMPANY_IMPORT_API_PATH
  );
}

View on GitHub (pinned to 3f1d897a7c)